setfilter?

nvermanverma Member Posts: 396
I want to create a filter that will fetch me all the data before a particular date.

fundsTransferredDate (is entered by the user and is off date type)
This is what I wrote, but its not working:
ConsumerDisbursement.SETFILTER(..,fundsTransferredDate)

Clearly, typing '..' does not work.

Any suggestions>?

Answers

  • nvermanverma Member Posts: 396
    This should definately work. But it doesnt.
    Im telling it to look at date field in the Consumer disbursement record...and look at all the dates till FundsTransferredDate.
    "Consumer Disbursement".SETFILTER(Date,'..FundsTransferredDate');
    

    It doesnt create a compiling error. But it creates a "FundsTransferredDate" is not a valid date. (i put that line of code in PreDateItem)
  • dipakpatel2505dipakpatel2505 Member Posts: 169
    Hello Nvarma,
    Please Try following way filter:

    "Consumer Disbursement".SETFILTER(Date,'..%1',FundsTransferredDate);

    If Tips is useful and solved problem then please donot forget to mark it as solved.
  • DenSterDenSter Member Posts: 8,307
    edited 2012-03-08
    nverma wrote:
    This should definately work. But it doesnt.
    Im telling it to look at date field in the Consumer disbursement record...and look at all the dates till FundsTransferredDate.
    "Consumer Disbursement".SETFILTER(Date,'..FundsTransferredDate');
    

    It doesnt create a compiling error. But it creates a "FundsTransferredDate" is not a valid date. (i put that line of code in PreDateItem)
    Why are you saying that it should work? Think about this. You are trying to set a filter on a Date field, with the value '..FundsTransferredDate'. That is a literal string, it is not a Date type. The second parameter of SETFILTER expects a text string, which you are providing, so therefore it compiles. You need to figure out how to get the value of the variable into the filter string.

    Open the C/SIDE Reference Guide, type in 'SETFILTER' in the Search box and click the 'List Topics' button. Select where it says SETFILTER and click the 'Display' button. Read and study the details of how to use the syntax. I am looking at it now and it even has a code example how to get a variable into the filter string. This help topic has all the information for you to figure this out.

    After you read that, and you still can't make it work, come back and tell me exactly what you did, what you expected to happen, and what actually happened.
  • nvermanverma Member Posts: 396
    edited 2012-03-08
    That worked!!!

    THANKS!!!

    @Den - What you said makes sense now. Thanks. I learned something new today.
  • DenSterDenSter Member Posts: 8,307
    nverma wrote:
    That worked!!!
    Do you understand why though? Did you actually figure out how it works or did you just copy the code hoping that it would fix your problem?
  • SavatageSavatage Member Posts: 7,142
    If "Took Densters Advice" Then
    MESSAGE('I learned something new on %1',TODAY)
    Else MESSAGE('Thanks for the correct coding. Reading the ADG and/or C/Side Ref Guide sucks!');
  • nvermanverma Member Posts: 396
    Savatage wrote:
    If "Took Densters Advice" Then
    MESSAGE('I learned something new on %1',TODAY)
    Else MESSAGE('Thanks for the correct coding. Reading the ADG and/or C/Side Ref Guide sucks!');


    hahahahaha
Sign In or Register to comment.