mibuso.com

Microsoft Business Solutions online community
It is currently Fri May 24, 2013 10:33 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: [Solved] How to include the DateFilter in the function???
PostPosted: Mon Jul 09, 2012 11:59 am 
Offline

Joined: Thu Jun 21, 2012 11:13 am
Posts: 273
Country: France (fr)
Hi everyone,

I have to use the following function:

Code: Select all
GenerateMatrixData(SetWanted,MaximumSetLength,UseNameForCaption,PeriodType,DateFilter,PKFirstRedInCurrSet,CaptionSet,CaptionRange,CurrSetLength,PeriodRecords)


The DateFilter parameter's type is Text and its max length is 30.

Now, the filter I have to use is the following:

Code: Select all
SETFILTER("Period Start",'>=%1',DMY2DATE(1,1,(DATE2DWY(TODAY,3)-1)));


How should I pass that to the function????
I am really new to C/AL code and I didn't do a lot of practice so I usually get confused when it's about writing code :oops: :oops:
Any help would be most welcome...


Last edited by poppins on Mon Jul 09, 2012 5:41 pm, edited 1 time in total.

Top
 Profile E-mail  
 
 Post subject: Re: How to include the DateFilter in the function???
PostPosted: Mon Jul 09, 2012 12:37 pm 
Offline

Joined: Thu Jun 21, 2012 11:13 am
Posts: 273
Country: France (fr)
Infact, the function automatically assigns the value of the parameter DateFilter to Period Start so I don't really need to specify that the filter is on Period Start...

I tried to introduce the DateFilter parameter this way:

Code: Select all
GenerateMatrixData(SetWanted,MaximumSetLength,UseNameForCaption,PeriodType,'>=DMY2DATE(1,1,(DATE2DWY(TODAY,3)-1))',PKFirstRedInCurrSet,CaptionSet,CaptionRange,CurrSetLength,PeriodRecords)


but I got the following error message:
Code: Select all
Overflow under type conversion of text to text
Value: DMY2DATE(1,1,(DATE2DWY(TODAY,3)-1))


What should I do???


Top
 Profile E-mail  
 
 Post subject: Re: How to include the DateFilter in the function???
PostPosted: Mon Jul 09, 2012 1:10 pm 
Offline

Joined: Wed Apr 07, 2004 9:39 am
Posts: 339
Location: Bangalore
Country: India (in)
Put the value in a date variable

TempDate := DMY2DATE(1,1,(DATE2DWY(TODAY,3)-1));

then pass

'>=FORMAT(TempDate)'

This shud work.. :)

Chn


Top
 Profile E-mail WWW  
 
 Post subject: Re: How to include the DateFilter in the function???
PostPosted: Mon Jul 09, 2012 2:43 pm 
Offline

Joined: Thu Jun 21, 2012 11:13 am
Posts: 273
Country: France (fr)
Chinmoy wrote:
Put the value in a date variable

TempDate := DMY2DATE(1,1,(DATE2DWY(TODAY,3)-1));

then pass

'>=FORMAT(TempDate)'

This shud work.. :)

Chn


Actually, it didn't work :(

I even tried :
Code: Select all
TextDate := '>=FORMAT(TempDate)';

where TextDate is a variable of type Text and then passed it to the function....

The result is the following error:
Code: Select all
'>=FORMAT(TempDate)' is not a valid date...


What can I do???


Top
 Profile E-mail  
 
 Post subject: Re: How to include the DateFilter in the function???
PostPosted: Mon Jul 09, 2012 3:17 pm 
Offline

Joined: Thu Jun 21, 2012 11:13 am
Posts: 273
Country: France (fr)
I finally did it....That's how I proceeded:
Code: Select all
TempDate := DMY2DATE(1,1,(DATE2DWY(TODAY,3)-1));
TextDate := FORMAT(TempDate);

DateFilter := '>= '+TextDate;


And I passed DateFilter to the function....It works :D

Thank you Chinmoy, you've been of a great help :D


Top
 Profile E-mail  
 
 Post subject: Re: How to include the DateFilter in the function???
PostPosted: Mon Jul 09, 2012 4:30 pm 
Offline

Joined: Wed Apr 07, 2004 9:39 am
Posts: 339
Location: Bangalore
Country: India (in)
You are welcome... :)

please mark the post as solved.

Chn


Top
 Profile E-mail WWW  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: medianoche and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: