I need to create a prompt that allows me to select, one value, multiple values from a list of values, or select all the values.
I found the following entry here on BOB that should be exactly what I need to do.
Is there anyone who can explain the following code to me in steps so I can try and recreate it using my own database? I am using a DB2 database if that is any help. The following is the code listed in the Entry here on BOB.
(@Select(Sales Geography\Country Group) IN @Prompt('Select Country Group or
enter * for all groups','a','Sales Geography\Country Group',multi,free) ) OR
('*' in @Prompt('Select Country Group or enter * for all groups','a','Sales
Geography\Country Group',multi,free))
The following is how I took the code above and set it up. I did something wrong becuase everytime I click run, it takes me right back to the data provider. Can someone help me understand what I did wrong:
@Select (D_ACCOUNT.I_ACCT (THIS IS MY FIELD NAME) ) in @prompt(‘Select CODE or Enter * for all CODES’,‘D_ACCOUNT.I_ACCT’ (THIS IS MY FIELD NAME) ,multi,free)) or(’*’ in @Prompt(‘Select CODE or Enter * for all CODES’,‘a’,‘D_ACCOUNT.I_ACCT’ (THIS IS MY FIELD NAME),multi,free))
You shouldn’t be using @Select. You are referencing an actual database column. @Select is used when you want to refer to an exising object.
You syntax for your first @Prompt is wrong. It does not contain a type. And it uses a database field for the LOV. LOVs have to use objects. Also be very careful with the case of your paramters. I’ve found @Prompt to be very sensitive. UPPER case always works.
D_ACCOUNT.I_ACCT in @PROMPT('Select CODE or Enter * for all CODEs,'Code\Code',multi,free)) or('*' in @PROMPT('Select CODE or Enter * for all CODES,'a','Code/Code',multi,free))
I changed it to take out the @select as well as changed the @prompt to reference the Object I need it to grab data from.
It still is not working. Everytime I click run, it brings me right back to the data provider.
D_ACCOUNT.I_ACCT in @PROMPT('Select CODE or Enter * for all CODES,'A','Code\Code',MULTI, FREE)) or ('*' in @PROMPT('Select CODE or Enter * for all CODES,'A','Code/Code',MULTI, FREE))
Please don’t be insulted by this: You need to be MUCH more careful with your syntax. You left out parameters and spaces. Did you even parse your object in Designer?
You should try to get the @prompt to work by itself before adding in all the complexity. You’d have gotten much farther, much faster.
No Insult at all. I have never done this before so to be honest I am taking others code and trying to manipulate it to what I need it to do. I am doing this all as a trial and error, and learning only when I don’t have something right.
The code you gave me is still not working, so I took your suggestion to get the @prompt to work first. I am close, it seems with the first @prompt. This is what I have:
D_ACCOUNT.I_ACCT in @prompt('Enter CODE','A','CODE\CODE',multi, free)
When I run this, it finally seems to run YEAH!! However when I enter a value, I get an Error during SQL run error (hopefully I am allowed to show my error):
I have disected your code over and over along with other examples of @Prompt that I have been able to find, but I cannot figure this out. The “(” that it is talking about is a part of my @Prompt. I also tried to make everything all upper case and it still doesn’t work.
Could this have something to do with the database I am running this against?
OK, I’m not clear on this. In your code above, you use in but your error message says the problem is a parenthesis following a like operator. Is one of those quotes incorrect?