Hi,
How can I assign a global variable to a request form so I can then use the value in the variable in a setfilter?
In the request form of a report, I have added a textbox in which the user enter a value.
The value is then used for filtering.
Thanks in advance,
0
Comments
In your DataItem in trigger DataItem - OnPreDataItem(), you can use your global variable as filtercriteria. For example:
Regards
1) Declare a global var
2) Make it source expression of the textBox in request form.
3) Use this var to filter anywhere in the report.
RecVar.setrange(RecVarField,yourGlobalVariable); OR
...........setfilter....................................................OR
anyway you want the value in the global variable. It is available to report's all dataItems and corresponding triggers
I hope it helps. O:)
Technical Consultant, MS Dynamics NAV
i have the same problem, but i'm a beginner, so can you explain this a little bit? I have a form and there you can select a date. when i print the record (the code to print this record is in the table in the PrintRecord trigger), i want to make a selection before i print that depends on this date. so do i have to declare a global variable in the table or in the form??? how can i access one of this variable from the other place?
But first: is this a form based on a table (f.ex. 112) or without a SourceTable ?
Regards
So, i think your source behind the Button looks like this (example use SalesInvHeader):
The Code in PrintRecords() looks like this (it's standard)
So you see, there is a copy function on a new Instance of the (here) SalesInvHeader. These Copy() function copies also all filters of the current REC (where yout form is based). So if you set a filter before your PrintRecord() command like
The report will print the Recs with this "Posting Date". But if no rec exist with your posting Date, a error pops up in function PrintRecords() (find('-'))
Also you can create a new function in your table like SetPrintParameters(Parameters) and these parameters you use as a global Variable in the PrintRecords() function. But also here: If no recs exist, the find('-') brings an error:
For more help, it's helpfully to see a codesnippes or the for self (picture)
Regards
that was the most helpful post i read. I did it with a new function on the table and used the global varaibles. So it works... Thank you.
Happy new year
Nico