Focal Point
[SOLVED](FOC003) THE FIELD IS NOT RECOGNIZED:USING COMPUTE FIELD SORT AND ACROSS SORT

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

March 21, 2017, 04:36 AM
Chaudhary
[SOLVED](FOC003) THE FIELD IS NOT RECOGNIZED:USING COMPUTE FIELD SORT AND ACROSS SORT
I am creating a WebFOCUS report using InfoAssist ,My report having one compute field , 1 sort field and 1 across fieLd
this report works until i did not apply sort on compute field .

  TABLE FILE ibisamp/car
SUM COMPUTE NEWSALE/D12.2=CAR.BODY.SALES /2;
BY CAR.ORIGIN.COUNTRY
ACROSS CAR.BODY.BODYTYPE
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = endeflt,
$
ENDSTYLE
END


When I applied sort on compute field , it gave me an error .(CAR.NEWSALE IS COMPUTE FIELD)

(FOC003) THE FIELDNAME IS NOT RECOGNIZED: CAR.NEWSALE
BYPASSING TO END OF COMMAND
(FOC009) INCOMPLETE REQUEST STATEMENT

 

TABLE FILE ibisamp/car
SUM COMPUTE NEWSALE/D12.2=CAR.BODY.SALES /2;
BY TOTAL NEWSALE NOPRINT
BY CAR.ORIGIN.COUNTRY
ACROSS CAR.BODY.BODYTYPE
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = endeflt,
$
ENDSTYLE
END
 



Please Suggest ,is this a limitation that we can not use compute field sort(BY TOTAL) and across sort together or I am doing in a wrong way .

while using hold file it works me but i don't want to to use hold file .

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


WF Production :- WF:8.0.0.4, 8.1.05 App-studio/Developer Studio(8.1.x) ,
8.2.0.1M , 8.2.0.2 (App-Studio8.2.x),
InfoAssist/+, InfoDiscovery
Output format:-AHTML, PDF, Excel, HTML
Platform:-Windows 7, 8,10
March 21, 2017, 09:48 AM
MartinY
It this what you're looking for ?
TABLE FILE CAR
SUM COMPUTE NEWSALE/D12.2=CAR.BODY.SALES /2;
BY CAR.ORIGIN.COUNTRY
BY CAR.BODY.BODYTYPE
ON TABLE HOLD AS TMP
END

TABLE FILE TMP
SUM NEWSALE
BY NEWSALE NOPRINT
BY COUNTRY
ACROSS BODYTYPE
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = endeflt,
$
ENDSTYLE
END



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
March 22, 2017, 02:40 AM
Chaudhary
Thankyou Martin,

By using hold file i am able to achieve this . But can we not use compute field in sort along with sort across.


WF Production :- WF:8.0.0.4, 8.1.05 App-studio/Developer Studio(8.1.x) ,
8.2.0.1M , 8.2.0.2 (App-Studio8.2.x),
InfoAssist/+, InfoDiscovery
Output format:-AHTML, PDF, Excel, HTML
Platform:-Windows 7, 8,10
March 22, 2017, 08:58 AM
MartinY
This can be a better way to have the result sorted by the total per country
DEFINE FILE CAR
NEWSALE/D12.2=SALES /2;
END
TABLE FILE CAR
SUM NEWSALES
BY TOTAL NEWSALE AS 'Total'
BY COUNTRY
ACROSS BODYTYPE
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = endeflt,
$
ENDSTYLE
END

Trying to answer your question : it's all about internal matrix and the moment the field are available to be used.

To simplify there is 2 steps in a TABLE...END process. Note that I'm not including the whole list, just sample.

In step 1 are processed : BY, ACROSS, WHERE, SUM/PRINT, DEFINE
In step 2 are processed : BY TOTAL, WHERE TOTAL, SUM/PRINT COMPUTE

To be able to use BY TOTAL NEWSALE (which is a step 2 command), NEWSALE must "exist before" the use of BY TOTAL. Meaning that the field must exist in the internal matrix before the use of BY TOTAL. So NEWSALE must exist in internal step 1.

When using SUM COMPUTE NEWSALE..., you're defining NEWSALE in internal step 2.

So to be ale to use BY TOTAL NEWSALE you must define NEWSALE in step 1.

Remember that the above is not a full technical explanation, just an overview, you can find more info in Knowledge Base or from IBI courses.


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
March 22, 2017, 02:19 PM
Danny-SRL
Chaudhary,

As per Martin's explanation, if your COMPUTE is a linear function of one variable (as in your example), you can use:
  
TABLE FILE CAR
SUM COMPUTE NEWSALE/D12.2=SALES /2;
BY TOTAL SALES NOPRINT
BY COUNTRY
ACROSS BODYTYPE
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = endeflt,
$
ENDSTYLE
END



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF