Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED?] "&" in a DM variable causes problems - how to solve?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED?] "&" in a DM variable causes problems - how to solve?
 Login/Join
 
Expert
posted
I have a Dialog Manager variable that contains a "&" e.g. &SYSTEM = "P&C Canada". I realize that this will cause problems. One solution I know of is to change the value of the variable to "P&|C Canada". Is there any other way to use the variable without changing the value?

This message has been edited. Last edited by: Francis Mariani,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Example (The Dialog Manager value is normally created by a -READ statement, for this example it is created by a -SET statement):

-SET &F1V1 = 'P&|C Canada';

-SET &F1V1L = &F1V1.LENGTH;
-SET &F1V1L1 = &F1V1L + 1;

-*STRREP (inlength, instring, searchlength, searchstring, replength, repstring, outlength, outstring)
-SET &F1V1 = STRREP (&F1V1L, &F1V1, '1', '&', 2, '&||', &F1V1L1, 'A&F1V1L1');

-TYPE &F1V1


The resulting value is wrong: "P&|C Cana"

Things are complicated by the fact that I have an & in a variable and I want to replace it with &| both of which are special characters for Dialog Manager.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
OK, I've fixed the STRREP by adding an EVAL:

-SET &F1V1 = STRREP (&F1V1L, &F1V1, '1', '&', 4, '&||', &F1V1L1, 'A&F1V1L1.EVAL');

I'd still like to know if there's another way to use the variable without having to use STRREP.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Francis,

Works the same way in 7.6.9 but I can't understand why the .EVAL works. Logic says that it should make no difference as the A&F1V1L1 is interpreted as A11 anyway.

I "fix" data inputs using STRREP as well and I haven't found a better way for me yet (always open to suggestions though). The main ones that we encounter are in free format text notes fields where the app adds line CRLF when the user hits "new line".

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
yes, I don't know why I needed the .EVAL in the STRREP function.

It appears I also need .EVAL for the report HEADING and WHERE statements:

TABLE FILE BBC_RWA
PRINT GROUP_RPT_DS
WHERE GROUP_RPT_DS EQ '&F1V1.EVAL'
WHERE READLIMIT EQ 1
HEADING
"&F1V1.EVAL"
END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Guru
posted Hide Post
Francis,

Perfect timing on this post! I have the same issue with data values containing the Ampersand character ('Lawn & Garden'). I'm already doing a STRREP to remove the OR and replace it with a comma. Then I pass these values to a SQL Passthru query and, oddly enough, they worked even though they looked like ('Lawn & Garden').

However, to be safe I think I'll use the .EVAL method you show here.

Regards,

Dan


7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
 
Posts: 393 | Location: St. Paul, MN | Registered: November 06, 2007Report This Post
Expert
posted Hide Post
Dan, I would think you're safe if the & has a space after it - my problem is of the A&B variety not A & B.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
I've had my morning coffee and I'm still not quite "getting it". Confused

I create a fex like this:
-SET &F1V1 = 'P' | '&' | 'C Canada';

-TYPE &F1V1

TABLE FILE CAR
HEADING
"&F1V1"
   PRINT CAR
   WHERE WARRANTY EQ '&F1V1' ;
-*  You can also use &F1V1.QUOTEDSTRING
END
  


which yields this:

P&C Canada
TABLE FILE CAR
HEADING
"P&C Canada"
   PRINT CAR
   WHERE WARRANTY EQ 'P&C Canada' ;
END

 NUMBER OF RECORDS IN TABLE=        0  LINES=      0
  
 
Posts: 164 | Registered: March 26, 2003Report This Post
Expert
posted Hide Post
EricH,

I need my afternoon tea after this one!

Here is code that does not work correctly:

-SET &F1V1 = 'P' | '&' | 'C CANADA';

-SET &SELF1 = IF '&F1V1' EQ 'PCG CANADA'
-  THEN 'WHERE WARRANTY NE ''PCG (TOTAL)'' AND COUNTRY NE ''ITALY'''
-  ELSE 'WHERE WARRANTY NE ' | '''&F1V1''';

-TYPE &F1V1

SET EMPTYREPORT=ON

TABLE FILE CAR
HEADING
"&F1V1"
PRINT CAR
&SELF1
END
-RUN

&SELF1 gets evaluated as
WHERE WARRANTY NE '&F1V1'


Putting a .EVAL in
-SET &SELF1 = IF '&F1V1' EQ 'PCG CANADA'
-  THEN 'WHERE WARRANTY NE ''PCG (TOTAL)'' AND COUNTRY NE ''ITALY'''
-  ELSE 'WHERE WARRANTY NE ' | '''&F1V1.EVAL''';
results in an error: (FOC295) A VALUE IS MISSING FOR: &C


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
<JG>
posted
Francis in this particular case the .EVAL
is required on the &SELF1 not the &F1V1

The reason being that you do not want the evaluation to take place in the -SET
you need it to take place at the time of the parsing of the WHERE
 
Report This Post
Platinum Member
posted Hide Post
Francis,

I don't know if it will work in your particular situation, but you can do this on the ELSE clause:

 
-  ELSE 'WHERE WARRANTY NE ' | '''' | &F1V1 || '''';
 


EricH
 
Posts: 164 | Registered: March 26, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED?] "&" in a DM variable causes problems - how to solve?

Copyright © 1996-2020 Information Builders