Focal Point
[CLOSED] InfoAssist: Maximum DEFINE or COMPUTE formula length?

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

June 05, 2020, 11:55 AM
Manoj
[CLOSED] InfoAssist: Maximum DEFINE or COMPUTE formula length?
Hi,

Does anyone know if there is any limitation on the size (that is number of characters) a DEFINE or COMPUTE formula may have?

I have a very large IF THEN ELSE condition and apparently due to it, InfoAssist is crashing. I am trying to remove conditions (not ideal from report perspective) to find out if there is any limitation in terms of characters and it's bit tedious. If anyone knows about any limitation, please could you let me know?

Thank you.

Kind regards,

Manoj.

This message has been edited. Last edited by: Manoj,


Newbie.
WebFOCUS 8.2.0.3.
Client 8.2.0.4.
June 05, 2020, 12:32 PM
BabakNYC
I don't know of a limitation like that in InfoAssit. A good test is to see if the same DEFINE would work if you created it in a TEXT EDITOR outside of InfoAssist.

I also think if a DEFINE is that long, perhaps it belongs to a master file.


WebFOCUS 8206, Unix, Windows
June 05, 2020, 02:40 PM
DWaybright
What Babak said -- when I have an issue like that I put it in the Command Console through AppDoc AppStudio and run it with display commands option. This usually helps me debug any issue I'm having in InfoAssist. If you don't have access to AppStudio (our business users don't) hopefully someone you work with does and can help you out.
Also, a quick check, make sure the format of the define file is correct. My business users often forget to change it from the default (a numeric format) which can cause a crash when the result is an alpha.
Good luck!

This message has been edited. Last edited by: DWaybright,


WebFOCUS 8.2.03 (production), 8.2.06 (testing)
AppStudio, InfoAssist
Windows, All Outputs
June 06, 2020, 04:48 PM
Manoj
Hi @BabakNYC

It is indeed a candidate for a master file. I assume only AppStudio can create a master file. Sadly we don't have access to the tool.

Thank for your reply. I shall check as per your reply next week.

Kind regards,

Manoj.


Newbie.
WebFOCUS 8.2.0.3.
Client 8.2.0.4.
June 06, 2020, 04:52 PM
Manoj
quote:
Originally posted by DWaybright:
What Babak said -- when I have an issue like that I put it in the Command Console through AppDoc and run it with display commands option. This usually helps me debug any issue I'm having in InfoAssist. If you don't have access to AppDoc (our business users don't) hopefully someone you work with does and can help you out.
Also, a quick check, make sure the format of the define file is correct. My business users often forget to change it from the default (a numeric format) which can cause a crash when the result is an alpha.
Good luck!


Thank you very much. I am not sure what AppDoc is but I shall explore it next week.

Kind regards ,

Manoj.


Newbie.
WebFOCUS 8.2.0.3.
Client 8.2.0.4.
June 08, 2020, 06:34 AM
Tony A
quote:
a very large IF THEN ELSE

There used to be a limit of 64 (I think) pairs in IF THEN ELSE.

Break it into separate fields or think of using a DECODE if you can.

Remember that SQL codesets normally have a limit of 1000 entries. This is not a WebFOCUS limit but the RDBMS that you are targeting.

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 
June 08, 2020, 06:37 AM
Tony A
By separate fields I mean something like this -

COMPUTE MYCOMP/A100 = IF fielda EQ 'value' THEN 'result'
                 ELSE IF … etc.
                 ELSE 'X';
COMPUTE MYCOMP/A100 = IF MYCOMP NE 'X' THEN MYCOMP
                 ELSE IF … etc.
                 ELSE 'X';


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 
June 08, 2020, 01:30 PM
DWaybright
D'oh! I meant AppStudio, not AppDoc. That was an in-house application I used at a previous employer (so much that apparently my brain won't let it go!

Sorry for the confusion.
--Deb


WebFOCUS 8.2.03 (production), 8.2.06 (testing)
AppStudio, InfoAssist
Windows, All Outputs
June 08, 2020, 02:08 PM
BabakNYC
Adding COMPUTEs and DEFINEs is not limited to App Studio. You can add them using the Reporting Server Console if you have access. When you edit a synonym, you can insert a field and add the calculation logic to the synonym. No App Studio required.


WebFOCUS 8206, Unix, Windows
June 09, 2020, 08:47 AM
jgelona
Have you tried DECODE? For example, when entering an address, items like Pre-Directional are selected from a picklist and store in the data base as a number. So when printing the address the Post Directional is decoded back to it value. We put the values in a table call adpredir.ftm. Filedef the table then use DECODE instead of If-Then-Else.

These are the values in adpredir.ftm
35 'E'
36 'N'
37 'NE'
38 'NW'
39 'S'
40 'SE'
41 'SW'
42 'W'


Then when building the address for printing inside DEFINE FILE we use the following (AD_PREDIR is a field in CLADD):
FILEDEF PREDIR DISK code_tables/adpredir.ftm ( LRECL 24 RECFM V
DEFINE CLADD
PREDIR/A2=DECODE AD_PREDIR(PREDIR ELSE '');
END


We do the same the with Street Suffixes, Post Directional, Unit Type, State, a 150 other fields in the database. These items (and many others), when they are entered, they are selected not manually typed. This allows our address to be entered in a standard, uniform format and allows for printing the address in the standard USPS format and we get a discount for mailing. I don't have to worry about someone entering STREET, ST, St, St., Stret, Strt, or any other way it could be mistyped.

Bottom line is using a file like this, you can put Entries in a file once, store it, and use it all the time.

You can use a similar technique for IF and WHERE statements. Say your values are in a SAVE file. Then you can use "If field EQ (SAVE)" or WHERE field IN FILE SAVE.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
June 12, 2020, 08:29 AM
Manoj
quote:
Originally posted by Tony A:
By separate fields I mean something like this -

COMPUTE MYCOMP/A100 = IF fielda EQ 'value' THEN 'result'
                 ELSE IF … etc.
                 ELSE 'X';
COMPUTE MYCOMP/A100 = IF MYCOMP NE 'X' THEN MYCOMP
                 ELSE IF … etc.
                 ELSE 'X';


T


Many thanks Tony for explaining the idea clearly with the examples.

Kind regards,

Manoj.


Newbie.
WebFOCUS 8.2.0.3.
Client 8.2.0.4.
June 12, 2020, 08:33 AM
Manoj
Thanks all for your inputs.

There is no issue now. I made a mistake in preparing the formula definitions. As there are a lot of IF THEN ELSE conditions, I used an Excel file to prepare the formula and for two out of three such formulae, I was wrongly referring to a wrong cell value (in Excel) which was causing InfoAssit to display an error and crash.

Apologies for my mistake. _/\_

Kind regards,

Manoj.


Newbie.
WebFOCUS 8.2.0.3.
Client 8.2.0.4.