Author Topic: Passing Custom text Condition for DateType Field  (Read 4991 times)

youngfitz

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 26
    • View Profile
Passing Custom text Condition for DateType Field
« on: October 16, 2018, 04:06:48 pm »
Hi,

I created a text custom condition for a Datetime Field but its not passing the value back because i suspect its a text value associated with date type property.
Is there anyway around this?

Thanks

youngfitz

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Passing Custom text Condition for DateType Field
« Reply #1 on: October 18, 2018, 10:52:25 pm »
Hi,

Apologises for pushing on this but did you get a chance to review?
FYI - We will be purchasing 3 licenses tomorrow.

Thanks

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6122
    • View Profile
Re: Passing Custom text Condition for DateType Field
« Reply #2 on: October 18, 2018, 11:40:59 pm »
Filter custom conditions are designed for and tested with local filtering.

I guess you are using it for remote filtering. Could you please share your custom text condition and column definition so that I can check it.

youngfitz

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Passing Custom text Condition for DateType Field
« Reply #3 on: October 18, 2018, 11:57:47 pm »
Hi,

Thanks for the reply. Yes, its for remote filtering. Below is the code to add the condition:

    pq.filter.conditions.fallswithdays = {
        filter: {
            attr: "",
            cls: "",
            style: "",
            type: 'textbox',
            init: pq.filter.textbox
        },
        date: 1,
        number: 1,
        stringList: 1,
        }
    }
    $.paramquery.pqGrid.defaults.strConditions.fallswithdays = "Falls within (days)";

This is added to a Property which is a Date Field. The standard conditions work correctly.

The controller method is hit but the pq_filter variable is always null.

The user wants to be able to save a grid with a INTEGER value and show records with a date period from the day the grid loads + the INTEGER value added -
So basically "DateField"<= Datetime.Now.AddDays(INTEGER VALUE).

Any help would be great.

Thanks

youngfitz

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Passing Custom text Condition for DateType Field
« Reply #4 on: October 19, 2018, 12:03:29 am »
Hi,

From further testing, it successfully will pass back the value when I use contains, EndsWidth etc... basically any of the built in existing conditions so it looks like when its a custom Condition, it does not pass it back.

Hope that helps.

Thanks
 

youngfitz

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Passing Custom text Condition for DateType Field
« Reply #5 on: October 22, 2018, 03:29:10 pm »
Hi,

Can this be moved to "Help for ParamQuery Pro" as the licenses were purchased. A seperate ticket was raised detailing the transaction ID and account details.

Thanks

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6122
    • View Profile
Re: Passing Custom text Condition for DateType Field
« Reply #6 on: October 22, 2018, 06:15:21 pm »
Could you please recheck the values in network console of your browser.

It's passing the value fine in my test by using fallswithdays for OrderDate column in this example for remote filtering:

https://paramquery.com/pro/demos/filter_header

Code: [Select]
pq_filter: {"mode":"AND","data":[{"dataIndx":"ContactName","dataType":"string","value":"M","condition":"begin"},{"dataIndx":"ShipRegion","dataType":"string","value":["RJ"],"condition":"range"},{"dataIndx":"OrderDate","dataType":"date","value":"8","condition":"fallswithdays"}]}
_: 1540211384537


In order to process it on server, you would need to add the logic for the new condition in deSerializeFilter method in your remote FilterHelper class.
« Last Edit: October 22, 2018, 06:20:20 pm by paramquery »

youngfitz

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Passing Custom text Condition for DateType Field
« Reply #7 on: October 23, 2018, 02:21:20 pm »
Hi,

I checked my network console and the pq_filter is not been passed back at all when I filter on the date with a INTEGER value. (see attached FallswithinDays.zip).

I checked another custom condition which is NOT for date fields and that passes it back successfully.

See attached(OtherCustomerConditionWorking.zip) where there is 2 columns been filtered - both custom conditions but only 1(days remaining is been passed back) is been passed.

In your check, did you create a new custom filter or rename an existing filter? I know your existing filters will work, it seems when its a custom filter, I experience the problem.

I understand I need to create the filter logic in the deSerializeFilter method but the issue is with the pq_filter string not been passed back.

I have also attached the JS used to create the custom condition.

Thanks

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6122
    • View Profile
Re: Passing Custom text Condition for DateType Field
« Reply #8 on: October 23, 2018, 07:47:38 pm »
Quote
In your check, did you create a new custom filter or rename an existing filter? I know your existing filters will work, it seems when its a custom filter, I experience the problem.

In my test, I created a new custom filter condition.

I've created a live test case in plnkr for verification.

https://plnkr.co/edit/hhtFUtQ0gZfPz0Icq0bw?p=preview

If you are still facing issue, please share a live test case so that I can check it for you.

youngfitz

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Passing Custom text Condition for DateType Field
« Reply #9 on: October 23, 2018, 09:41:18 pm »
Hi,

Thanks for this. I found the issue. I set the format of the date field to be "dd-mm-yy" and this causes the issue when passing a non date value.
In your example, i added format:'dd-mm-yy' to the OrderDate and I could see the the network console that the filter was not passed.
Is there potentially another way to setting the format of dates?

Thanks

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6122
    • View Profile
Re: Passing Custom text Condition for DateType Field
« Reply #10 on: October 23, 2018, 10:44:11 pm »
Ok, got it.

Please remove date: 1 and add dateList: 1 in the filter definition.

Code: [Select]
pq.filter.conditions.fallswithdays = {
    filter: {
      attr: "",
      cls: "",
      style: "",
      type: 'textbox',
      init: pq.filter.textbox
    },
    dateList: 1
  }

Working fine now:

https://plnkr.co/edit/hhtFUtQ0gZfPz0Icq0bw?p=preview

youngfitz

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Passing Custom text Condition for DateType Field
« Reply #11 on: October 24, 2018, 04:02:53 pm »
Hi,

Thanks for this. I have it working now.
You can close the ticket.

Thanks