passing 2 parameters from a textbox to a crystal report

mmy

Member
Joined
Oct 5, 2007
Messages
24
Programming Experience
1-3
Hi,

I created a DataSet MCO with 2 DataTables "Customers" and "Materials". With this I create a report (crystal report) showing the customers with it's materials (linked by an ID). The materials are shown in a subreport.

In this subreport I need some extra calculated fields. I can do this by inserting a function, that's no problem...but... To calculate this I need info of 2 textboxes on a windows form. These text boxes are no part of the table. Is it possible to "import" these values into the report and use these variables use in a function?

I found somthing about passing variables to a report, but I can't get it to work (yet). But I'm not sure this is the right way (caus maybe this is something like parameters in a query like in Access). Can anybody help me please?

edit: I also need to make a total of these calculated fields...So I'm not sure if I can use a function. On every detail line I will receive the right value, but is it possible to make a total sum too at the report footer? In Access I made a make-table query adding this extra field to the table. With this new table I created a report, and then I could make a sum.
 
Last edited:

mmy

Member
Joined
Oct 5, 2007
Messages
24
Programming Experience
1-3
Can anybody help me with this problem?
I found something about passing variables to a report, and tested it. Before the report opens, it asks me for 2 values. I can use these in my function, but then I still can't make a sum of a function field...
 

DavidT_macktool

Well-known member
Joined
Oct 21, 2004
Messages
502
Location
Indiana
Programming Experience
3-5
YOU CAN KEEP A RUNNING TOTAL OF YOUR FORMULA FIELD ON THE DETAIL LINE AND JUST SUPPRESS IT.
SOMETHING LIKE:

ADD A FORMULA FIELD... @FormulaFieldSUM
Drop on the detail band - you can suppress it after you see it works...

CRYSTAL SYNTAX
Formula =

VB.NET:
WhilePrintingRecords;
currencyvar SUMTotal;
SUMTotal := SUMTotal + {@YourFormulaField};

add another formula field... @DisplayTotal
Put it on the report footer:

CRYSTAL SYNTAX
Formula =

VB.NET:
WhilePrintingRecords;
currencyvar DisplayTotal;
DisplayTotal := SUMTotal;


There are other options than "currencyvar" available also...
See if that works...
 

mmy

Member
Joined
Oct 5, 2007
Messages
24
Programming Experience
1-3
David,
thanks for the reply. I'm using a dummy table with the 2 extra variables in (the one I used as a parameter in the report).

Now I can make a function in the detail section and in the report footer a running total (insert - sum).

I'll try this way when I get in the same situation. Thanks
 
Top Bottom