Data is passed from phiReport to the Excel Template via named shapes and named cells.


There are two methods to pass data to the template.


  1. From the phiReport interface


       


       The Value Pair table allows you to enter a matching Name and Value pair of data.  The Name is matched with the the Shape/Cell Name on the template.  The value can be a string, a formula (starts is '=' equal sign) or a replacement token (starts with '%%@' and ends with '%%').  


Formulas are evaluated by Excel while replacement Tokens are evaluated by phiReport.

phiReport introduces New Formula to provide page specific calculations.   

       


  1. From your BASIC program (see PHIDEMOBP Demo_Invoice_PreQuery


       To pass data from your BASIC program to the Form template, add a COMMON definition to your program then build the shared variables.


       COMMON /USERVAR/ USERDATA, P_STATUS, RptPrompts


               

       USERDATA: Single attribute array representing the Value Pair table.  Each value represents 1 entry with 2 sub-values.

       USERDATA<1,1,1> = "NAME1"

       USERDATA<1,1,2> = "VALUE1"


       P_STATUS: Program Status.  Returns program status to phiReport.  For error handling, return "ERR" in P_STATUS<1> and an error message in P_STATUS<2>.  phiReport will display the error message to the end user.


       RptPrompt: Table of value pair user prompts.  User prompts are Replacement Tokens defined on the report.  






In our example, 2 Replacement Tokens are defined in the criteria section, %%@USERPORT%% and %%@Invoice Number%%.

%%@USERPORT%% is a phiReport internal token and is automatically replaced by the system's user port (@PIB, @USERNO depending on your Database platform)

%%@Invoice Number%% is a custom defined replacement token.  phiReport will prompt the user for the "Invoice Number" value and it will be added to the RptPrompts COMMON variable.


If a custom replacement token is used multiple times in the report, the user will only be prompted once.


RptPrompts is a single attribute array representing the Value Pair table.  Each value represents 1 entry with 2 sub-values.

RptPrompts<1,1,1> = "Token1"

RptPrompts<1,1,2> = "Value2"