Focal Point
[SOLVED] Question about embedded procedures and computed values

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

August 24, 2010, 04:17 AM
Wep5622
[SOLVED] Question about embedded procedures and computed values
I discovered the new embedded procedures that the Report painter now generates, and that seems a really cool feature!

I'm having a little trouble wrapping my head around something though. I have a dropdown list that I need to fill with values and descriptions, where the descriptions should be computed from the concatenation of two fields!

I have no trouble creating code that generates said output in the console, but I can't make the dropdown box pick up those values...

My embedded procedure looks like this:
DEFINE FILE warhousp
 NAM/A40 = WHWARC | ' - ' | WHDWHS
END
TABLE FILE warhousp
 BY NAM
 BY WHWARC
-*insert_filters_here
ON TABLE PCHOLD FORMAT XML
END


In the above, NAM should be used for the descriptions and WHWARC for the values.

I changed the data_info tag to use:
datafield="WHWARC"
ibiformat="A2"
displayfield="NAM"
dfformat="A40"


Yet, the dropdown stays empty. It works if I just use WHDWHS for the displayfield attribute though...

So what am I doing wrong here?
How do you debug these embedded procedures?

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


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
August 24, 2010, 04:48 AM
Dave
3 things...

-1-
When using a define in an embedded proc.
If you click the [...] button to select the display value, your NAM field will probably not show.
I think because WF firstly refers to the master, not to the show code.

At least in my experience,
I couldn't get this to work either.. ..and I also tried a compute in the procedure.

-2-
You have 2 BY fields.
I think one should be a sum like WF generates the code itself.
SUM FST.NAM
BY WHWARC
( not sure.. )

-3-
Only way I could get this to work is use external procedure.
In my opinion far better.
Better for maintenance.
Better for testing/debugging.
Better for reusability.


You could copy-paste the code to the console to test / debug by the way.

G'luck.
Not much of a solution, just some things I ran into.


_____________________
WF: 8.0.0.9 > going 8.2.0.5
August 24, 2010, 04:52 AM
Wep5622
I solved this by adding a define to our local master file.

Originally we feared that such defines would get overwritten as soon as we'd refresh the synonym from our database server, but it turns out WF merges the defines back in nicely! No need to worry about that Smiler


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
August 24, 2010, 09:54 AM
Francis Mariani
I'd be careful about the DEFINE's in the Masters. Behaviour in v7.6.5:

Right-click > Refresh Synonym: The DEFINE is kept.

Create Synonym > Overwrite existing synonyms: The DEFINE is not kept.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server