Focal Point
[CLOSED] Help! Fex Runs but not when called by HTML Page

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

August 10, 2018, 11:56 AM
RobertF
[CLOSED] Help! Fex Runs but not when called by HTML Page
Its been a while since I experienced the joy of troubleshooting these quirks! We are still on WF 8008. I have a fex that creates a few HOLD files and then a report. it runs fine stand alone. It immediately fails when referenced by an HTML page. I tried to make this a simple as possible to illustrate what is going on. I only show the first part of the process, since that is where it fails....

If I run this fex it runs error free writing 64 records to the hold file.

APP HOLD foccache
SET ASNAMES = ON
-DEFAULT &INVCREATIONPERIOD = 201807
-DEFAULT &RPTBANBR = 30600


JOIN
LEFT_OUTER
TABLE1.TABLE1.INVCREATIONPERIOD
IN TABLE1 TO UNIQUE
TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.PERIOD IN TBLMSTR_CALENDARPERIOD
TAG J5 AS J5
END

DEFINE FILE TABLE1
RPTPD/I11=&INVCREATIONPERIOD;
END

TABLE FILE TABLE1
SUM
TABLE1.TABLE1.IDXRVU99WRVUS
TABLE1.TABLE1.BUDGWRVUS
BY LOWEST TABLE1.TABLE1.BILLINGPROVIDERNM
BY LOWEST RPTPD

WHERE ( TABLE1.TABLE1.INVCREATIONPERIOD LE &INVCREATIONPERIOD.(OR(FIND TABLE1.TABLE1.INVCREATIONPERIOD,TABLE1.TABLE1.INVCREATIONPERIOD IN TABLE1)).INVCREATIONPERIOD:. );

ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS HOLDDTLS FORMAT ALPHA
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END



When I reference this fex on an HTML page and run, it ends in error:

0 ERROR AT OR NEAR LINE 16 IN PROCEDURE New_ProcedureFOCEXEC *
(FOC282) RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD: RPTPD
0 ERROR AT OR NEAR LINE IN PROCEDURE new_procedure
(FOC003) THE FIELDNAME IS NOT RECOGNIZED: RPTPD
BYPASSING TO END OF COMMAND
(FOC009) INCOMPLETE REQUEST STATEMENT


What the heck is going on. RPTPD is the value the user chooses for the INVCREATIONPERIOD - see WHERE with LE condition - but I also want to bring this value along for use in a subsequent fex, hence RPTPD. It is I11 as is the TABLE1.INVCREATIONPERIOD.

Again, the fex runs fine EXCEPT when on the HTML page.

Can you help?

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8206.08
Windows, All Outputs
August 10, 2018, 12:09 PM
BabakNYC
Add WITH BILLINGPROVIDERNM to your define and see if it fixes it.
  
DEFINE FILE TABLE1
RPTPD/I11 WITH BILLINGPROVIDERNM =&INVCREATIONPERIOD;



WebFOCUS 8206, Unix, Windows
August 10, 2018, 12:15 PM
RobertF
..same error!


WebFOCUS 8206.08
Windows, All Outputs
August 10, 2018, 12:32 PM
BabakNYC
I would turn on &ECHO to see what's being substituted. -SET &ECHO=ALL;

Also, would it make a difference if you add .EVAL to &INVCREATIONPERIOD?
  
DEFINE FILE TABLE1
RPTPD/I11 WITH BILLINGPROVIDERNM =&INVCREATIONPERIOD.EVAL;



WebFOCUS 8206, Unix, Windows
August 10, 2018, 01:09 PM
RobertF
no that did not make a difference.

Funny if I hard code RPTPD to equal 201807 I STILL get the error...


WebFOCUS 8206.08
Windows, All Outputs
August 10, 2018, 01:29 PM
RobertF
Oops..I mean IT WORKS when I hard code it...it must have something to do with the &INVCREPERIOD...no idea what though....


WebFOCUS 8206.08
Windows, All Outputs
August 10, 2018, 01:43 PM
RobertF
I thought perhaps this was due to the multiselct OR...changed it to a single select...now it seems to work...makes sense I guess. Not sure why the fex let it go but the ehtml page did not...


WebFOCUS 8206.08
Windows, All Outputs
August 10, 2018, 02:21 PM
MartinY
Try with the fallowing
RPTPD/I11=EDIT(&INVCREATIONPERIOD);

As far as for what I can see, applying a value to a variable as you did (-DEFAULT &INVCREATIONPERIOD = 201807) make the value as alphanumeric, not a number.
So trying to assign a characters to an Int field (RPTPD/I11=&INVCREATIONPERIOD) it's not valid.


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 10, 2018, 03:35 PM
RobertF
Well, after I changed the WHERE to a DINGLE select it worked.

Why do you say:
-DEFAULT &INVCREATIONPERIOD = 201807

yields an alphanumeric...and how would I alter this piece to make it numeric anyway?

RPTPD must be numeric...it gets linked to another table a few queries down the road and that filed is numeric...

Like I said, I think the multi select was the culprit....I am just getting back to this...we will see if it continues to work...


WebFOCUS 8206.08
Windows, All Outputs
August 10, 2018, 03:56 PM
Hallway
I think that the problem that you are running into is that with a multiselect, it will be alphanumeric by default because if the end user makes a multiple selection, then the value of the parameter will be each value that was selected separated by an 'OR' or comma so it would have to be an alpha.

This might demonstrate it. This is a multi-select:
 
TABLE FILE CAR
SUM CAR.BODY.SALES
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
BY CAR.BODY.SEATS
WHERE CAR.BODY.SEATS EQ &SEATS.(OR(FIND CAR.BODY.SEATS IN CAR |FORMAT=I3)).SEATS:.;
ON TABLE HOLD
END

-RUN

-TYPE &|SEATS/&SEATS.TYPE&SEATS.LENGTH = &SEATS  

When I select the values 2 and 4 I get the following output:
  
0 NUMBER OF RECORDS IN TABLE=       10  LINES=      9
&SEATS/A10 = '2' OR '4'

The parameter is an A10

This is single select:
TABLE FILE CAR
SUM CAR.BODY.SALES
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
BY CAR.BODY.SEATS
WHERE CAR.BODY.SEATS EQ &SEATS.((FIND CAR.BODY.SEATS IN CAR |FORMAT=I3)).SEATS:.;
ON TABLE HOLD
END

-RUN

-TYPE &|SEATS/&SEATS.TYPE&SEATS.LENGTH = &SEATS 

When I select the number 2 I get this:
  
0 NUMBER OF RECORDS IN TABLE=        5  LINES=      4
&SEATS/N01 = 2

The parameter is Numeric with a length of 1

So, in your code above:
quote:

  
DEFINE FILE TABLE1
RPTPD/I11=&INVCREATIONPERIOD;
END


You cannot assign an alpha that is returned from a multi-select to an I11.

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


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
August 10, 2018, 04:25 PM
Hallway
Try removing your define and change the BY field to the field INVCREATIONPERIOD and defining the field type in your WHERE
  
APP HOLD foccache
SET ASNAMES = ON
-DEFAULT &INVCREATIONPERIOD = 201807
-DEFAULT &RPTBANBR = 30600


JOIN
LEFT_OUTER
TABLE1.TABLE1.INVCREATIONPERIOD
IN TABLE1 TO UNIQUE
TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.PERIOD IN TBLMSTR_CALENDARPERIOD
TAG J5 AS J5
END

-* DEFINE FILE TABLE1
-* RPTPD/I11=&INVCREATIONPERIOD;
-* END

TABLE FILE TABLE1
SUM 
TABLE1.TABLE1.IDXRVU99WRVUS
TABLE1.TABLE1.BUDGWRVUS
BY LOWEST TABLE1.TABLE1.BILLINGPROVIDERNM
-* BY LOWEST RPTPD
BY LOWEST TABLE1.TABLE1.INVCREATIONPERIOD

WHERE TABLE1.TABLE1.INVCREATIONPERIOD LE &INVCREATIONPERIOD.(OR(FIND TABLE1.TABLE1.INVCREATIONPERIOD,TABLE1.TABLE1.INVCREATIONPERIOD IN TABLE1 |FORMAT=I11)).INVCREATIONPERIOD:.;

ON TABLE SET PAGE-NUM NOLEAD 
ON TABLE NOTOTAL
ON TABLE HOLD AS HOLDDTLS FORMAT ALPHA
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END

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


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
August 10, 2018, 04:38 PM
Hallway
quote:
Originally posted by RobertF:
Not sure why the fex let it go but the ehtml page did not...


I'm curious. Does the fex still work if you select multiple values in the selection?


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs: