SELCASE() return code

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Mariovaisman
Posts: 133
Joined: February 11th, 2013, 8:26 am

SELCASE() return code

Post by Mariovaisman »

Hello,
I am having some issue with the referred function, up to cspro version 7.6, the return code was 1 if selected or 0 if not, however in cspro version 7.7, it is something different, in case not selected the value is 0, as usual, however if found, it return the record number, not only a "1", if I select the first in the list, it returns a 1, if select the second it returns "2", for the third "3", and above. I think it is an issue because in the help it is clear that the return code is 1 or 0. I tested it in a windows device, didnt check in an android device.
In old applications I was asking for a "1" that was working properly in previous cspro version, and now it didn't work, then I sent an errmsg to see the return code. Now I changed the logic to value <> 0.

Thanks

Mario
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: SELCASE() return code

Post by Gregory Martin »

You are right: this changed in CSPro 7.7.0. We will restore the original behavior (always returning 1 or 0) for CSPro 7.7.1. In the meantime, if you want the old behavior, you can turn off the usage of HTML dialogs:

https://www.csprousers.org/help/CSPro/p ... tures.html

The new behavior was accidentally introduced when we introduced the new style of selcase.
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: SELCASE() return code

Post by Gregory Martin »

Mario,

CSPro 7.7.1 has been released. You can get it here: https://www.csprousers.org/downloads/

This should fix the problem. Selcase should only return 1/0 when used to select a single case in an external file.
Enkhbayar
Posts: 68
Joined: November 10th, 2014, 11:48 pm

Re: SELCASE() return code

Post by Enkhbayar »

Gregory Martin wrote: February 8th, 2022, 12:25 pm Mario,

CSPro 7.7.1 has been released. You can get it here: https://www.csprousers.org/downloads/

This should fix the problem. Selcase should only return 1/0 when used to select a single case in an external file.
I still have the same problem with CSPro 7.7.1 . If I select the escape key [ X ] function returns the last case of the lookup.
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: SELCASE() return code

Post by Gregory Martin »

Selcase iterates through all cases in your file, so the last one will be in memory when the selcase dialog shows. If you hit the escape key, the function will return 0, but that last case will still be in memory. I believe this has been the behavior since the beginning. You will want to check the return value of the function so that you do not incorrectly handle the last case when the user canceled the dialog.
Post Reply