NetTalk Central

Author Topic: NetWebServiceMethod - SQL Filter  (Read 4479 times)

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
NetWebServiceMethod - SQL Filter
« on: March 15, 2018, 03:01:58 AM »
Hi,

I see that the PROP:SQLFilter generated when an SQL filter value is provided in the response of a method, always adds '+' in front to concatenate the SQL filter to the values previously set in PROP:Filter.

If I don't want this behaviour, and have the SQL filter as the only expression, I'll have to change the template (or use OMIT over a large block of code). Is there another way to get rid of the '+' character?

Thys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetWebServiceMethod - SQL Filter
« Reply #1 on: March 16, 2018, 12:00:55 AM »
Let me counter your question with a question.

In what circumstances is prop:filter being set, where you don't want it to be set?
I can obviously remove the + but I'm not wild to do that because the prop:filter is set by either
a) you - in which case you're in control or
b) me - in which case I'm not sure the filter _should_ be removed...

But I'm open to being convinced, so explain away!  :)

cheers
Bruce


Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: NetWebServiceMethod - SQL Filter
« Reply #2 on: March 16, 2018, 12:18:21 AM »
Bruce,

It is for me to have control, is that I don't always want the response of a GET to be just one record. It can be a longer list of records as defined by a Search variable. If the PROP:SQLFilter is added to the end of the PROP:Filter, then only one record will be returned when the PROP:SQFilter is empty, and none when the PROP:SQLFilter tries to get more records (because it's using an AND in the WHERE clause to combine the filters).

Actually, one way to avoid this (maybe) is to set the "Filter" value in the template to '' thereby preventing the default PK filter to be set - so the PROP:SQLFilter will be the only filter available. It looks like this can be a solution without any changes to the template.

Coming back to control, with none of "Filter" or "SQL Filter" values set, the template code defaults to the PK filter. With only "Filter" set, it works as expected. But with only "SQL Filter" set, it combines the default PK filter and the "SQL Filter", which causes some confusion - why doesn't it work like when only "Filter" is set? An option for change could be a checkbox after the "SQL Filter" to indicate it's an exclusive filter.

Thanks

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetWebServiceMethod - SQL Filter
« Reply #3 on: March 19, 2018, 12:34:03 AM »
Hi Thys,

I feel like your real issue is this;

>> With only "Filter" set, it works as expected. But with only "SQL Filter" set, it combines the default PK filter and the "SQL Filter",

In other words, when filter is not set it sets the PK filter. It should be "if filter AND sqlfilter are not set"....

I'll tweak that for 10.19

cheers
Bruce