Hello, I've create a date type variable called datefilter and I put i on the request form. The report shows sale orders (from sales line table) and I filter them buy Shipment Date on running the report. I want that the variable "datefilter" form request form, acts as the field Shipment Date and filter the orders as it was the Shipment Date field.
Thanks in advance.
0
Comments
Use the DateFilter variable on Request form instead of a Filter in field "Shipment DAte" for filtering all recs on SalesLine with filter on "Shipment Date" base on DateFilter variable?
If yes, use this:
Now, if the user has entered a value in the DateFilter field on Request form, the report filter the Sales Line based on this value for field "Shipment Date".
Regards
Thanks again for help
Try
SalesLine.setfilter("Shipment Date",FORMAT(DateFilterVariable));
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
Thank you very much for your help.
Can you post some code and I can have a look.
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
These are the Dataitems:
Item <Item>
Sales Line <Sales Line>
Purchase Line <Purchase Line>
Purchase Line <Purchase Line2>
Purchase Header <Purchase Header>
Purch. Inv. Line <Purch. Inv. Line>
Item Ledger Entry <Item Ledger Entry>
Entero <Entero>
Entero Entero2
And, on PreDataItem from Sales Line Dataitem put the code:
IF ( <> 0D) THEN
"Sales Line".SETFILTER("Shipment Date", FORMAT(DateFilterVariable));
That's all; afater, on OnAfetergetRecord from Sales Line Dataitem there is more code; but is much and I don't know if it's important; if you want that I put it there is any problem.
Thanks for help.
"Sales Line".reset <-- this return all filters
or
"Sales Line".setrange("Shipment Date"); <-- this return the filter on the field
The setfitler function you only need if your DateVariable inclueds a filtersting like 01.01.2008..31.12.2008.
If it is only one Date you can use
"Sales Line".setrange("Shipment Date",DateVariable);
"Sales Line".RESET;
"Sales Line".SETRANGE("Shipment Date",datevaribale);
the report don't filter me by date, it shows all the sales orders without filtering by date, and the Shipment Date change into the date that I have put on de datevariable. Any other idea please?.
Thanks for help.
Thanks.
Copy & paste it into a post. Select it all then hit the [Code] button.
http://www.BiloBeauty.com
http://www.autismspeaks.org
after analyzing your code .......
Your date Filter Variable is "fechafiltro".
This you set on the request form. There the user can insert a date as filter.
These filter you want to use in your linked dataitems (Purchase Line, Sales Line).
So, to use this date as filter condition, the correct "place" is the OnPreDataItem of the selected DataItem.
Sales Line - OnPreDataItem()
setrange("Shipment Date",fechafiltro); //this is a filter on field Shipment Date only on table Sales Line
This select definitly only the Sales Lines for your selected Item (here Sales Line) on DataItem Item.
To check if the filter is working you can also set a error message in
Sales Line - OnAfterGetRecord()
error('The Filtered Shipment Date = %1,"Shipment Date");
and if your report doesn't show Sales Lines, is the other question: Exist there some sales lines with your selected Shipment date?
Also check the value of variable "sindetalle". if it is true, you doesn't print the sections
Regards
The truth is I'm doing exactly what he told me, but I'm being filtered instruction in the OnpreDataItem of SalesLine, making it well I get everything in white, not use the "no detail". However, if I remove the code from OnpredataItem and put it in the Sales Line body it filtered properly, but only a record of which are within the time indicated that, if there is not more than one sample, is as if it not journey the whole the table.
For example, I put a filter on the date 12/12/08, and there are two registers that satisfy the condition, the first dated 5/12/08 followed by another dated 8/11/07 but it only shows me the 8/11/07 dated, skips the first register that also satisfy the condition. I don't know if that can give you some hint of what may be happening.
Thank you very much indeed for your help and your time.
As Garak says it's difficult to import this version for me so I'm just reading the code.
Is the dataitem filter on the sales line dataitem filtering out the record for the 5/12/08 ?
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
Thanks for reply and help.
Thanks in advance.