creating a formula for the requirement

Hi all…
I have a requirement as follows…
When a user enters a number in the prompt the query fetches a code from the database and the code can have E, M, I and a bunch of others as the values. and I need to assign these numbers depending on how they appear on the report.

if its a combination of E and M or E and I then we should see 03 for all the codes
if its just E then 02 and if its either M or I then 01
here’s a few examples

Code Number
E 03
M 03
I 03
A 03
S 03

code number
E 03
M 03

Code number
I 03
E 03

code number
E 02
S 00

code number
M 01
I 01
A 00

if E appears with either M or I for that particular entry then all the codes are supposed to be assigned 03 individually. and if they appear individually then the respective 01 and 02 codes. and 00 for all others.

any ideas??
Thanks


bsn (BOB member since 2005-09-10)

There are so many combinations might come in the report. you should try to write a ‘If-Then-Else-If’ statement and check all the possibilities and then assign the values

This is what I can advise.


BO_Chief :us: (BOB member since 2004-06-06)

At universe level, create an object called “Number” with this code:


Case 
  When @Prompt('Select code(s)','A',{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'},multi,constrained) like 'E' 
     and @Variable('Select code(s)') like 'M' then '03' 
  When @Variable('Select code(s)') like 'E' 
     and @Variable('Select code(s)') like 'I' then '03' 
  When @Variable('Select code(s)') like 'E' then '02' 
  When @Variable('Select code(s)') like 'M' 
     or @Variable('Select code(s)') like 'I' then '01' 
  Else '00' 
End

jac :australia: (BOB member since 2005-05-10)

Case
When @Prompt(‘Select code(s)’,‘A’,{‘A’,‘B’,‘C’,‘D’,‘E’,‘F’,‘G’,‘H’,‘I’,‘J’,‘K’,‘L’,‘M’,‘N’,‘O’,‘P’,‘Q’,‘R’,‘S’,‘T’,‘U’,‘V’,‘W’,‘X’,‘Y’,‘Z’},mono,constrained) like ‘E’
and @Variable(‘Select code(s)’) like ‘M’ then ‘03’
When @Variable(‘Select code(s)’) like ‘E’

I cannot do this at the universe level. I have to do it at the report level after the codes are extracted from the database. All the codes appear distinctly in each row and there could be multiple occurrences of the code.
In that case the same logic applies as the examples.
Let me know if anyone has some ideas!

thanks


bsn (BOB member since 2005-09-10)