Focal Point
[SOLVED] Comma Separated Dynamic Autoprompt

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6467051096

May 14, 2018, 07:02 PM
Hallway
[SOLVED] Comma Separated Dynamic Autoprompt
Is there a way to pass a comma separated, list of text values (so each value need to be in single quotes) from an autoprompt?

I found this in the docs: How to Add a Dynamic Multiselect List of Values

In that I learned that you can use a comma instead of OR where it says:
quote:

operation
Specifies how to evaluate multiple values. May contain the value OR, AND, or a comma (,). If omitted, the default value is OR.


So I tried the following:
-TYPE &COUNTRY.(,(FIND CAR.ORIGIN.COUNTRY IN CAR |FORMAT=A10)).COUNTRY:.;

And do I get this returned with comma separated values:
 
ENGLAND , FRANCE , ITALY , JAPAN , W GERMANY; 

However it needs to have single quotes around each value like when OR is used:

-TYPE &COUNTRY.(OR(FIND CAR.ORIGIN.COUNTRY IN CAR |FORMAT=A10)).COUNTRY:.; 
'ENGLAND' OR 'FRANCE' OR 'ITALY' OR 'JAPAN' OR 'W GERMANY'; 

This message has been edited. Last edited by: FP Mod Chuck,


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
May 15, 2018, 07:59 AM
BabakNYC
Try this instead:

 -TYPE &COUNTRY.(OR(FIND CAR.ORIGIN.COUNTRY IN CAR |FORMAT=A10)).COUNTRY:.; 



WebFOCUS 8206, Unix, Windows
May 15, 2018, 12:50 PM
Hallway
quote:
Originally posted by BabakNYC:
Try this instead:

 -TYPE &COUNTRY.(OR(FIND CAR.ORIGIN.COUNTRY IN CAR |FORMAT=A10)).COUNTRY:.; 


Yes, I have that at the bottom of my post showing how the 'OR' separated list has single quotes around each item.

I need a comma (,) separated list with single quotes around each item

Currently I have to do the following:
  
-TYPE &|COUNTRY Before: &COUNTRY.(OR(FIND CAR.ORIGIN.COUNTRY IN CAR |FORMAT=A10)).COUNTRY:.;
-SET &COUNTRY = IF &COUNTRY CONTAINS ''' OR ''' THEN TRIM_(BOTH, ' ', STRREP(&COUNTRY.LENGTH, &COUNTRY, 4, ' OR ', 2, ', ', &COUNTRY.LENGTH, '&COUNTRY.TYPE&COUNTRY.LENGTH') ) ELSE &COUNTRY;
-TYPE &|COUNTRY After: &COUNTRY;


And that returns:
 &COUNTRY Before: 'ENGLAND' OR 'FRANCE' OR 'ITALY' OR 'JAPAN' OR 'W GERMANY';
 &COUNTRY After: 'ENGLAND', 'FRANCE', 'ITALY', 'JAPAN', 'W GERMANY';
  


I am just wondering if it is possible to get the '&COUNTRY After' results listed above without STRREP manipulation. Since IBI does have the ability to do comma separated values by using a comma instead of 'OR', I was just wondering if it were possible to use this with alpha values as well as numeric to be able to utilize an IN statement without having to do some big ol' hairy function


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
May 15, 2018, 01:07 PM
BabakNYC
Sorry, I misunderstood. There's a simplified string function called REPLACE and that seems to be easier than STRREP.


 
-TYPE &COUNTRY.(OR(FIND CAR.ORIGIN.COUNTRY IN CAR |FORMAT=A10)).COUNTRY:.; 
-SET &NEW_COUNTRY= REPLACE(&COUNTRY, ' OR ', ',');
-TYPE COUNTRY: &COUNTRY
-TYPE NEW_COUNTRY: &NEW_COUNTRY 



WebFOCUS 8206, Unix, Windows