Focal Point
[SOLVED] Evaluate COMPUTE expression

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

January 16, 2013, 07:51 AM
Carlos Dias
[SOLVED] Evaluate COMPUTE expression
Hello,
I'm trying to find a way to get the columns fields that a COMPUTE expression contains.
Something like:
COMPUTE XPTO/A30 = COL1+COL2+COL3;

I thought in using the WF parsing functions to get the columns. But is very difficult to parse complex expression.

The other option was something like:
TABLE FILE filename
PRINT COMPUTE XPTO/A30 = COL1+COL2+COL3;
ON TABLE HOLD AS RES
END

CHECK FILE RES HOLD AS MYCHECK
TABLE FILE MYCHECK
PRINT *
END

This way I get the COL1, COL2 and COL3. The point is that I need to execute the query. In may case this is not an option.
So my question is: It's possible to get this information without executing the query?

Or maybe there is another way to solve this issue.

Thanks in advanced,
Carlos Dias

This message has been edited. Last edited by: Carlos Dias,


WebFOCUS version: 7.6
Linux/Windows
HTML, Excel
January 16, 2013, 03:35 PM
Waz
Why do you want to eval COMPUTES ?

Is there a reason or problem ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

January 16, 2013, 05:34 PM
Carlos Dias
There is no problem at all... I just want to get the columns of the COMPUTE to make another operations.

I can get this running the query. But the best was to create the HOLD to get the master file without running the query. It's possible? Why is necessary to execute the query to get the master file created by the HOLD? The data is not necessary.

Thanks,
Carlos Dias


WebFOCUS version: 7.6
Linux/Windows
HTML, Excel
January 16, 2013, 05:56 PM
FrankDutch
Should the result of the expression be an a30 field?
But maybe I lust do not understand the question.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

January 16, 2013, 06:09 PM
Francis Mariani
Carlos,

To get a Master for a HOLD file without accessing the data, add this code before the TABLE FILE command:

SET XRETRIEVAL=OFF
Change it to ON when you want to access data (or delete the command).

You are using + signs in your COMPUTE statement, we assume the columns COL1, COL2 and COL3 are numeric. If so, XPTO must be numeric. If COL1, COL2 and COL3 are alphanumeric, you need to concatenate the columns:

COMPUTE XPTO/A30 = COL1 | COL2 | COL3;
COMPUTE XPTO/A30 = COL1 || COL2 || COL3;


| - Weak concatenation - Preserves trailing blanks.

|| - Strong concatenation - Moves trailing blanks to the end of a concatenated string.


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
January 17, 2013, 07:50 AM
Carlos Dias
The XRETRIEVAL works.

In the example XPTO in not a alphanumeric, but a number.

Thank you.


WebFOCUS version: 7.6
Linux/Windows
HTML, Excel