Here is the end of some code one of my former colleagues left me, and it is the part I need to change prior to my next stage.
I read that FPRINT converts any type of field except a text field to alphanumeric, and that makes complete sense to me.
COMPUTE FMEASURE/A100 =
IF DETAIL EQ 'D' AND MEASURE LT &small THEN '^' ELSE
IF COUNTER EQ 1 AND MEASURE EQ MIN_VALUE THEN '^' ELSE
FPRINT(MEASURE, 'D11', 'A40'); AS '&measure'
So, I understand my table will have ^ (carets) and entries such as 1,100, depending on the small cell test.
I want to convert the field's format from alphanumeric to numbers for such instances as 1,100 and MISSING (not zeroes) for the instances marked above by carets.
I need the MISSING feature because I'm going to use the results in a calculation. My calculation is set up with MISSING already, and it works in some other procedures where I do not have this data format issue.
At first, I thought ATODBL would do the trick, but I think the caret makes it a little more challenging.
Then, I thought about something like this:
DEFINE FILE TABLE MEASURE2/D12C MISSING ON= IF (MEASURE EQ '^') THEN MISSING ELSE MEASURE; END
At this point, my business use case does not allow me to change the code I posted at the beginning. So, I need to change the format after that.
Thoughts?This message has been edited. Last edited by: JulieA,
WebFocus 8.2.04 WebFocus 8.2.04
August 19, 2020, 04:32 AM
Efrem
Julie, I'm not sure I understand your example.
MEASURE2/D12C MISSING ON= IF (MEASURE EQ '^') THEN MISSING ELSE MEASURE;
What is the format of MEASURE? If you're saying MEASURE EQ '^', that would assume MEASURE is ALPHA. Then, you're trying to assign an Alpha to Numeric.
I'm taking a guess but do you want to do something like the following: MEASURE2/D12C MISSING ON= IF (MEASURE EQ '^') THEN MISSING ELSE EDIT(MEASURE);
August 19, 2020, 07:44 AM
MartinY
Julie,
MEASURE is already a numeric field, FMEASURE it's the equivalent alpha value where some values are replaced by carets under some conditions.
If I understand properly, to accomplish the same conditions as for FMEASURE but keeping it as a numeric field, the below should work
COMPUTE MEASURE2/D11 MISSING ON = IF DETAIL EQ 'D' AND MEASURE LT &small THEN MISSING
ELSE IF COUNTER EQ 1 AND MEASURE EQ MIN_VALUE THEN MISSING
ELSE MEASURE;
May need to be a DEFINE instead of a COMPUTE
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
August 21, 2020, 03:24 PM
JulieA
Everyone,
Thank you for your replies. I apologize for not responding sooner. I did not realize I had notifications turned to the OFF setting.
I actually figured out my data conversion issue, so I will close this post.
I have a different question. I will write my question in a new post.