[SOLVED] Amper Variable not Storing Entire Content
Hi,
I am using the below code to get a long string value (1000 characters) and store it in amper variable &FNOTE1. The problem is when I use the variable I only get part of the string, not the entire string. If I use variable &FN2, it shows entire string but when I run the report, it prompts for variable &FN2, which I do not want. Can you please suggest how to get the entire string in the variable &FNOTE1 without it prompting for the variable when run? Thanks in advance!
SQL
SELECT LISTAGG(FOOTNOTE, ', ') WITHIN GROUP (ORDER BY FOOTNOTE) FN2
FROM (SELECT DISTINCT FOOTNOTE FROM COMP_DATA
WHERE COMPONENT_ID >= 111
AND COMPONENT_ID <= 228
AND INCLUDE_IN_REPORTS ='Y');
TABLE
ON TABLE HOLD AS TEMPHLD1
END
-RUN
TABLE FILE TEMPHLD1
SUM FN2
ON TABLE HOLD AS CIS
END
-RUN
-READFILE CIS
-DEFAULTH &FNOTE1=&FN2.EVAL;
This message has been edited. Last edited by: FP Mod Chuck,
WebFocus 8.1 Service Pack 0.5 Build Version branch8105 Build/GEN Number 119
OS/Platform: Apache Tomcat/8.0.21
March 29, 2017, 12:12 PM
susannah
first, try validating that your READFILE actually got you something, by following the READFILE command with a -? &F which would show you the &vars starting with the letter F that you have in your workspace.
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
March 29, 2017, 01:00 PM
Sandeep
The variable FN2 does get the entire string. That I believe means READFILE gave the value to FN2 variable. But if I use this variable in the FOOTER and run the report, it prompts for FN2.
WebFocus 8.1 Service Pack 0.5 Build Version branch8105 Build/GEN Number 119
SQL SELECT LISTAGG(FOOTNOTE, ', ') WITHIN GROUP (ORDER BY FOOTNOTE) FN2 FROM (SELECT DISTINCT FOOTNOTE FROM COMP_DATA WHERE COMPONENT_ID >= 111 AND COMPONENT_ID <= 228 AND INCLUDE_IN_REPORTS ='Y'); TABLE ON TABLE HOLD AS TEMPHLD1 END -RUN
TABLE FILE TEMPHLD1 SUM FN2 ON TABLE HOLD AS CIS END -RUN -READFILE CIS
It did not work. I still get prompted for the FN2 variable and also it does not get the value. Is this because now the value is being SET?
WebFocus 8.1 Service Pack 0.5 Build Version branch8105 Build/GEN Number 119
OS/Platform: Apache Tomcat/8.0.21
March 29, 2017, 03:25 PM
BabakNYC
Sandeep: Does this work?
-SET &RETAIL_COST=;
-RUN
TABLE FILE CAR
SUM RETAIL_COST
ON TABLE HOLD AS CIS
END
-RUN
-READFILE CIS
-SET &FNOTE1=&RETAIL_COST.EVAL;
-TYPE VALUE OF RETAIL_COSTIS &RETAIL_COST
-TYPE VALUE OF FNOTE1 IS &FNOTE1
WebFOCUS 8206, Unix, Windows
March 29, 2017, 04:40 PM
Waz
If you are going to use .EVAL, you will need to make sure the string is enclosed in quotes.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
March 30, 2017, 06:04 AM
Wep5622
This is how:
TABLE FILE TEMPHLD1
SUM FN2
ON TABLE HOLD AS CIS
END
-RUN
-READFILE CIS
-DEFAULTH &FN2='';
-TYPE FN2 : &FN2
People are abusing EVAL far too often. If you don't need to have the contents of your (Dialog Manager) amper-variable re-parsed by Dialog Manager, you don't need EVAL.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
March 30, 2017, 05:52 PM
Waz
quote:
People are abusing EVAL far too often
This indicates a limited understanding of FOCUS and Dialog Manager.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
March 31, 2017, 03:02 PM
Fernando
What about using ASNAMES
SET ASNAMES=ON
SQL
SELECT LISTAGG(FOOTNOTE, ', ') WITHIN GROUP (ORDER BY FOOTNOTE) FN2
FROM (SELECT DISTINCT FOOTNOTE FROM COMP_DATA
WHERE COMPONENT_ID >= 111
AND COMPONENT_ID <= 228
AND INCLUDE_IN_REPORTS ='Y');
TABLE
ON TABLE HOLD AS TEMPHLD1
END
-RUN
TABLE FILE TEMPHLD1
SUM FN2 AS 'FNOTE1'
ON TABLE HOLD AS CIS
END
-RUN
-READFILE CIS
This way you do not need FN2 as variable it reads it directly into FNOTE1
Fernando
Prod WF 8.1.04, QA WF 8.2.03, Dev WF 8.2.03
April 03, 2017, 04:29 AM
Tony A
quote:
-DEFAULTH &FNOTE1=&FN2.EVAL;
This is why you are getting prompted.
To my knowledge (wait for the flood of responses here) you are not able to supply a variable to a -DEFAULT or -DEFAULTH.
I'll not bother to go into the reasons why this might be illogical to do anyway!
This has been discussed a few times before.
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
April 03, 2017, 05:52 PM
Waz
Hi Tony,
With the .EVAL is does work.
But only with the .EVAL
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
April 04, 2017, 02:53 AM
Tony A
Hi Waz,
When did that happen? I thought that this was one of those "if only we could" things that we dream of!
Well, you're never too old to learn something new
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
April 04, 2017, 03:08 AM
Tony A
Well, knock me down with a feather!
using the following (i.e. -DEFAULTHing &FN2) works OK, but for me I'd rather use the suggestion by Fernando unless there's a really good reason that you need &FN2 elsewhere within your code
T
Edited to change DEFAULTH statement after being corrected by Danny
-DEFAULTH &FN2 = ''
TABLE FILE CAR
BY MODEL AS FN2
WHERE CAR EQ 'JAGUAR'
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS TEMPHLD1
END
-RUN
TABLE FILE TEMPHLD1
SUM FN2
ON TABLE HOLD AS CIS
END
-RUN
-READFILE CIS
-DEFAULTH &FNOTE1=&FN2.EVAL
-TYPE &FNOTE1
-TYPE &FN2
This message has been edited. Last edited by: Tony A,
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
April 04, 2017, 06:46 AM
Danny-SRL
It stands to logic that you can assign a variable to another with -DEFAULT using .EVAL &FN2.EVAL is replaced by its value before assignment, hence it behaves as a constant and not a variable. What I am fearful about is the semi-colon. I know that many users put a semi-colon at the end of a -DEFAULT as some also put a semi-colon at the end of a -GOTO command. It seems innocuous but then one day the code will be tightened and then...
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
April 04, 2017, 06:50 AM
Tony A
quote:
semi-colon at the end of a -DEFAULT
That will teach me to copy'n'paste
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
April 04, 2017, 07:41 AM
Waz
And with .EVAL most dialog manager commands can be controlled.
I once set up a GOTO for -INCLUDES inside the calling fex.
Consider this simplified example.
Include:
-SET &RTN_CONTROL = IF &FOCERRNUM NE 0 THEN 'GOTO ERROR_CONTROL' ELSE '*' ;