NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Thys on October 06, 2017, 04:05:14 AM

Title: NetWebService - incorrect sort order for VIEW results
Post by: Thys on October 06, 2017, 04:05:14 AM
Hi,

When returning a VIEW parameter in a web method on a TPS file, there is no way to override the sort order in which data is returned. In fact, even the default of the PK is not used for the results. I looked at both the JSON and XML portions in the code, there is a PROP:ORDER set to the PK column, but the results are not correct. Is there another way to specify the required order?

Thys
Title: Re: NetWebService - incorrect sort order for VIEW results
Post by: Thys on October 06, 2017, 06:17:29 AM
Hi,

I did see that prop:order gets or sets a string, but the template generates the column name without the string quotation characters. After changing source to use a string instead of the column name, the sort order is now correct.

But there is still the question on how to override the sorting order for the result.

Thys
Title: Re: NetWebService - incorrect sort order for VIEW results
Post by: Thys on October 06, 2017, 06:24:18 AM
Hi,

Second iteration and my problem is solved. In the template dialogue there is a field "Order By" and there was already a column name without quotes. Looks like when you press the button next to it and mistakenly select a sort column from the table (instead of a string variable that contains the required sort columns), the template doesn't warn you and result in a possible incorrect sort order.

Thys
Title: Re: NetWebService - incorrect sort order for VIEW results
Post by: Bruce on October 23, 2017, 10:07:03 PM
Hi Thys,

this is by design.

Most of the template settings are "expressions". Meaning they take constant strings (ie with quotes) or variables (without quotes) or more complicated expressions.

So the template doesn't warn you because putting a variable name in there without quotes is both expressly allowed, and desirable in many cases.

In cases where fixed values (not expressions) are used there's usually a template prompt (no quotes).

Cheers
Bruce