Focal Point
[SOLVED] Changing an OR separated value

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

April 23, 2019, 01:50 PM
ccollier
[SOLVED] Changing an OR separated value
Hi all,
I've been working on an HTML page that uses checkboxes. The way the checkbox string is produced, it is equal to something like
'X' OR 'Y' OR 'Z'
But the quotes around each individual value are creating a bit of a problem. I have found that if I manually enter it, it will work if the outputted string is formatted in one of two ways.
'X OR Y OR Z', or
X,Y,Z
How would I change the way the string is formatted to be either of those?

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


WebFOCUS 8.2.01M on Windows 10
April 23, 2019, 02:06 PM
jfr99
One way ...

-*
-SET &IND_SECT  = '''X'' OR ''Y'' OR ''Z''';
-SET &IND_SECT1 = TRUNCATE(STRREP(&IND_SECT.LENGTH,&IND_SECT,6,''' OR ''',4,' OR ',&IND_SECT.LENGTH,A&IND_SECT.LENGTH));
-*
-TYPE IND_SECT -------------- &IND_SECT
-TYPE IND_SECT(LENGTH) ------ &IND_SECT.LENGTH
-TYPE -----------------------
-TYPE IND_SECT1 ------------- &IND_SECT1
-TYPE IND_SECT1(LENGTH) ----- &IND_SECT1.LENGTH



WebFocus 8.201M, Windows, App Studio
April 23, 2019, 02:14 PM
jfr99
Or this gives you both ...

-*
-SET &IND_SECT  = '''X'' OR ''Y'' OR ''Z''';
-SET &IND_SECT1 = TRUNCATE(STRREP(&IND_SECT.LENGTH,&IND_SECT,4,' OR ',1,',',&IND_SECT.LENGTH,A&IND_SECT.LENGTH));
-SET &IND_SECT2 = TRUNCATE(STRREP(&IND_SECT1.LENGTH,&IND_SECT1,1,'''',0,'',&IND_SECT1.LENGTH,A&IND_SECT1.LENGTH));
-*
-TYPE IND_SECT -------------- &IND_SECT
-TYPE IND_SECT(LENGTH) ------ &IND_SECT.LENGTH
-TYPE -----------------------
-TYPE IND_SECT1 ------------- &IND_SECT1
-TYPE IND_SECT1(LENGTH) ----- &IND_SECT1.LENGTH
-TYPE -----------------------
-TYPE IND_SECT2 ------------- &IND_SECT2
-TYPE IND_SECT2(LENGTH) ----- &IND_SECT2.LENGTH



WebFocus 8.201M, Windows, App Studio
April 23, 2019, 02:39 PM
jfr99
This gives you both using the REPLACE function ...

-SET &IND_SECT = '''X'' OR ''Y'' OR ''Z''';
-SET &IND_SECT1 = REPLACE(&IND_SECT, ''' OR ''', ' OR ');
-SET &IND_SECT2 = REPLACE(REPLACE(&IND_SECT, ' OR ', ',') ,'''', '');
-*
-TYPE IND_SECT -------------- &IND_SECT
-TYPE IND_SECT(LENGTH) ------ &IND_SECT.LENGTH
-TYPE -----------------------
-TYPE IND_SECT1 ------------- &IND_SECT1
-TYPE IND_SECT1(LENGTH) ----- &IND_SECT1.LENGTH
-TYPE -----------------------
-TYPE IND_SECT2 ------------- &IND_SECT2
-TYPE IND_SECT2(LENGTH) ----- &IND_SECT2.LENGTH



WebFocus 8.201M, Windows, App Studio
April 24, 2019, 10:43 AM
rcramos
I believe you just need to go to the checkbox properties and set the "Multiple: Add quotes" setting to "No".


WebFOCUS 8.0.09
Windows 7