Focal Point
[SOLVED]Subtract from year variable

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

October 20, 2014, 04:54 PM
Nyssa Darter
[SOLVED]Subtract from year variable
I am trying to subtract one from a variable that is being passed through a portal. The variable is a year and comes back as a string. Every time I try to subtract one it gives me an error on the -. I have tried numerous ways but cannot find one that works. Any ideas on a better way to do this?

-DEFAULT &MBR_YEAR = '2014';
-SET &DATA_YEAR = &MBR_YEAR-1;

This message has been edited. Last edited by: Nyssa Darter,


WebFOCUS 8.04
Windows 7, All Outputs

October 20, 2014, 05:03 PM
Waz
If you can guarantee that the variable is only numeric, then just add .EVAL to the -SET command.

-DEFAULT &MBR_YEAR = '2014';
-SET &DATA_YEAR = &MBR_YEAR.EVAL - 1;



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!

October 20, 2014, 05:15 PM
Nyssa Darter
Ahh yes that was what I was missing. Thanks for the help!


WebFOCUS 8.04
Windows 7, All Outputs