I have a shipmentdate filter field (text). I want to check this field for '.' If there is no period than I want to change the shipmentdate filter to a range which will contain the date already in the filter plus the filter date +9D, and then insert back into the shipmentdate filter. I am getting a conversion error. DATE := TEXT
*This post is locked for comments
I have found the answer about the missing filters showing for the headings and the problem was with the FILTERGROUP. It had changed it to 0 right after the checkdate and modification of field so passing the information was in filtergroup(2). Thank you guys for all your help with the date!
I just reset the shipmentdate filter the table filters were passed to the report however the reportfilter and shipmentdate filter fields are empty, do u guys know how to fix that? Is it some type of refresh after I have reset the shipment filter
So I did find out the problem was that the shipmentdatefilter field was blank. However, the reportfilters field, that shows all the filters combine is populated. But I think that the way I have to go about this is in the Page Action of the form right before it does the copyfilters to SalesHeader, have it check the shipmentdate filter field and see if it is a single date by doing above. If it is a single date, make shipmentdate filter a range (single date - single date +9D), then do setfilter shipmentdate filter, then copyfilters SalesHeader. At this point, can I only set the shipmentdate filter and it will keep the rest of the filters that are already entered on the page, or do I need to SalesHeader.reset and reapply all the filters again.
Archer the Shipmentdatefilter field is a TEXT
Hi Kim,
You can try below:
//Declare lDat_ShipmentDate as Date local variable.
//Keep what user inputed for values filter
IF (DELCHR(ShipmentDateFilter, '=', '|&=<>') <> ShipmentDateFilter) OR (STRPOS(ShipmentDateFilter, '..') > 0) THEN
EXIT;
//Convert to Date
IF EVALUATE(lDat_ShipmentDate, ShipmentDateFilter) THEN
ShipmentDateFilter := STRSUBSTNO('%1..%2', lDat_ShipmentDate, CALCDATE('<+9D>', lDat_ShipmentDate));
hi,
From the above code, it seems that ShipmentDateFilter is variable of type Date. It has to be of type Text.
Best Regards,
MMV
is the filter variable of type date or text?
Even tried
REFDATE := CALCDATE('<+9D>',ShipmentDateFilter)
STILL DID NOT WORK
POS := STRPOS(ShipmentDateFilter,'..');
IF POS = 0 THEN
REFDATE := CALCDATE('+9D',ShipmentDateFilter)
ShipmentDateFilter := ShipmentDateFilter + '..' + Format(REFDATE,0);
----------pos is integer and Refdate is date
getting type conversion is not possible because 1 of the operators contains an invalid type, DATE := Text
use Position := STRPOS(filter, '.') - or better '..' instead of '.' - to check if the filter string contains a range.
with endDate := CALCDATE('+9D', startDate); you get the end date for the range.
for usage with the filter expression convert the endDate to string using format(endDate).
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,113 Super User 2024 Season 2
Martin Dráb 229,918 Most Valuable Professional
nmaenpaa 101,156