Welcome! Log In Create A New Profile

Advanced

Global Variables in Reports

Posted by Denis Vaughan.pcs.crosspost 
Denis Vaughan.pcs.crosspost
Global Variables in Reports
October 02, 2008 04:22PM
Is it possible to declare global variables in reports, assign a value in the click process of a report control and then using EXTERN in a form, use the values on that form.

I have declared the following in the Opening of the report :

GLOBAL
gxQWCommTotal is numeric
gxO2CommTotal is numeric
gxCommDiff is numeric

In the Click item of the report control I have:

gxCommDiff=RPT_MatchTotals.CALC_CALCULATION1
gxO2CommTotal=RPT_MatchTotals.CALC_Sum_Comm_O2
gxQWCommTotal=RPT_MatchTotals.ITEM_COMM_QW
Info("O2 Commission is",RPT_MatchTotals.CALC_Sum_Comm_O2)
Info("QW Commission is",RPT_MatchTotals.ITEM_COMM_QW)

Open(WIN_Matched,RPT_MatchTotals.ITEM_ID_QW)

The attempt to assign the values to the variables are lines 1 - 3.
Line 4 and 5 were to test if I could have other actions on the click and the open form works fine.

But with lines 1 - 3 active I get unexpected fatal error at the point I am trying to assign the value to the variable.

Is this possible ?

Message forwarded from pcsoft.us.windev
Piet van Zanten
Re: Global Variables in Reports
October 02, 2008 04:30PM
Hi Dennis,

I don't think a global variable is visible outside the report.
You could add an extra parameter in the report opening section.
I f your report changes this parameter, it will also be changed in the calling window.

Regards,
Piet
Denis Vaughan.pcs.crosspost
Re: Global Variables in Reports
October 23, 2008 10:16AM
Hi, wonder does anyone know if this is possible ?

I want to pass the value from a report into a form that is opened using the click through function in the report (which works really well).

I have a report that lists results of a query 'summed'. When you click the row in the report it shows the individual rows from the query in a (table) form that make up that report row and allow you to then work with the data as normal. However I want some of the 'summed' values to appear in edit boxes on the form. I thought using variables from the report to the form might be a solution.

The other possibility would be to have an edit field on the form outside the table control which calculates the total of a column from with in the table control (this would actually be better as the table information may change from the report data with user interaction).

Thanks

Denis

Message forwarded from pcsoft.us.windev
Al
Re: Global Variables in Reports
October 23, 2008 11:22AM
Hello Dennis

We define a set of global variables in the project init for use in reports and elsewhere so they are available right across the entire project

GNReportCurrency0 is currency
GNReportCurrency1 is currency
GDReportDate0 is date
GLReportBoolean0 is boolean
GLReportString0 is string
etc

We actually describe 10 of each type of variable
I appreciate that some might regard this as sloppy programming but they come in handy for situations like you describe and especially when a client throws a really odd request at you.

In your case you would clear them at the start of the report, then fill in the values inside the report and they would be available for your click through form



Regards
Al



Edited 3 time(s). Last edit at 10/23/2008 11:25AM by Al.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: