Decoding Values using @Prompt

Hello Folks,
I am currently working on BO 6.5.1 and need some help with regards to creating a predefined condition by decoding certain values. The values should be grouped together to form a group. For Ex: the values 1,2,3,5 should be grouped together to be put into the parameter as ‘XXX’, while a single value 6 should be used as a prompt value called ‘YYY’. How would I write a @prompt statement to resolve this request.

The approach that I have followed here is by creating a dimension object which I am using as a LOV in the predefined condition with @prompt. When I enter ‘XXX’ or ‘YYY’ in the prompt, it would fetch no data. But, when I am entering the numeral value, it gets me the right data.

Here is a brief illustration of the objects that I have created:

Dim_obj - CASE WHEN table.column IN (‘1’,‘2’,‘3’,‘5’) THEN ‘XXX’
WHEN table.column IN (‘4’) THEN ‘YYY’ END

Predefined_Condition - table.column in @Prompt(‘Enter Type’,‘A’,‘Dim_obj’,MONO,free)

Thanks in advance for your help.


anupsingh (BOB member since 2006-03-27)

Hi,

Create the predefined condition this way:

@Select(class\dim_obj) in @Prompt('Enter Type','A','class\dim_obj',multi,free)

Marek Chladny :slovakia: (BOB member since 2003-11-27)

Hi Marek,
Can you please tell me the difference between using table.column and @select(class\dim_obj)

table.column in @Prompt(‘Enter Type’,‘A’,‘Dim_obj’,MONO,free)
@Select(class\dim_obj) in @Prompt(‘Enter Type’,‘A’,‘class\dim_obj’,multi,free)


GNK_BO (BOB member since 2007-07-17)

It’s because your object has the decode in it. You need to use the coded value, not the source data, in order for the compare to the prompt to match.


Dave Rathbun :us: (BOB member since 2002-06-06)

The difference is that in the first case, the prompt is compared directly to table.column while in the second case the prompt is compared to the definition of the dim_obj object from the class.

What @select() does is it takes the select part of the definition of an object (in this case the object is class\dim_obj) and place it where the function is used. So if ‘class\dim_obj’ is defined as

CASE WHEN table.column IN ('1','2','3','5') THEN 'XXX'
     WHEN table.column IN ('4') THEN 'YYY'
END 

Then this condition

@Select(class\dim_obj) in @Prompt('Enter Type','A','class\dim_obj',multi,free)

will be replaced by this code in the moment when BO will send the query to a database:

CASE WHEN table.column IN ('1','2','3','5') THEN 'XXX'
     WHEN table.column IN ('4') THEN 'YYY'
END in @Prompt('Enter Type','A','class\dim_obj',multi,free)

I hope it makes sense :slight_smile:


Marek Chladny :slovakia: (BOB member since 2003-11-27)

Marek / Dave,

Thanks for the prompt and brief explanation of the issue. I will test this tomorrow morning and will update the forum accordingly.

Appreciate ur help.


anupsingh (BOB member since 2006-03-27)

Marek,

Thanks for the code. Its working like a charm now. Appreciate it buddy.


anupsingh (BOB member since 2006-03-27)