Date Conversion

BVGBVG Member Posts: 18
Hello All,

Can anyone suggest how can we convert date to text in Navision.

User will enter From and To date in the form and from these dates I will have to subtract no. of days from these dates , these no.of days will also be entered by the user.

Then I have to calculate the flow field values depending on the flowfilters.

Now, the problem is flowfilter is a text variable, how do I convert the date to text which I can use as a flowfilter.

Thanks.
BVG

Comments

  • rajpatelbcarajpatelbca Member Posts: 178
    Can anyone suggest how can we convert date to text in Navision.

    Date1 := TODAY;
    test := FORMAT(Date1);
    MESSAGE(test);

    Regards,
    Experience Makes Man Perfect....
    Rajesh Patel
  • BVGBVG Member Posts: 18
    I have to subtract no. of days and then use the result date in flow filter which has to be date type, otherwise there will be a run time error.
  • rajpatelbcarajpatelbca Member Posts: 178
    try this
    Date1 := CALCDATE('-1D',TODAY);
    date2 := TODAY;
    test2:= date2-Date1;
    test := FORMAT(Date1);
    MESSAGE(test +'D: '+FORMAT(test2));

    here date1,date2 are date variable.
    test2 is an integer. test variable is type of text.

    hope it helps.
    Experience Makes Man Perfect....
    Rajesh Patel
  • krikikriki Member, Moderator Posts: 9,110
    First subtract the number from your date and then convert it:
    datNewDateStart := datTheDateStart - intSomeDaysToSubtract;
    txtTheNewDateStart := FORMAT(datNewDateStart);
    datNewDateStop := datTheDateStop - intSomeDaysToSubtract;
    txtTheNewDateStop := FORMAT(datNewDateStop);
    

    Maybe you can also do something like this:
    SETFILTER("Date Filter",datNewDateStart - intSomeDaysToSubtract,datNewDateStop - intSomeDaysToSubtract);
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.