I'm using Powerbuilder 12.5. In design mode I have expression on protected which is working how is intend. When i run application is not working at all. Any help please.
- You are here:
- Home
- Q&A
- Q&A
- PowerBuilder
- Protected expression is not working
- Viktor Serguienkov
- PowerBuilder
- Monday, 25 February 2019 23:29 PM UTC
- Tuesday, 26 February 2019 01:34 AM UTC
- PowerBuilder
- # 1
It would help if you told us what the expression is.
- Tuesday, 26 February 2019 14:37 PM UTC
- PowerBuilder
- # 2
Here my scenario: I have 3 check boxes on line with value 1 for checked and 0 for unchecked. The goal is if one is checked other two to be protected. So in expression fro cb_3 i wrote: IF(cd_1=1 or cb_2=1,1,0) for other two the logic is the same. In design mode works perfectly fine but in run time expression is not applying
- Tuesday, 26 February 2019 16:52 PM UTC
- PowerBuilder
- # 3
Hi Viktor;
Could you have more than one instance of the DWO ... one with the expression and one without? If yes ... depending on the library list, the DWO without the expression could be used at App run-time( vs what you see in the IDE).
Just a thought.
Regards ... Chris
- Viktor Serguienkov
- Tuesday, 26 February 2019 17:11 PM UTC
-
Helpful Loading... Helpful 0
- Chris Pollach @Appeon
- Tuesday, 26 February 2019 19:22 PM UTC
Is the DWO's "expression" static (via DW painter) or dynamic (added at run-time)?
-
Helpful Loading... Helpful 0
- Tuesday, 26 February 2019 19:59 PM UTC
- PowerBuilder
- # 4
Hi, Viktor:
I note in your comment to the first reply the expression you gave is: IF(cd_1=1 or cb_2=1,1,0), so I don't know if that is a typo error or if the expression you copy/pasted references cd_1 instead of cb_1.
I threw together in a couple of minutes, a bare-bones test application in PB9 and PB2017 R2 (I don't have PB12.5, sorry) and the expressions work as expected in both versions in the DW painter, when running the test app from the IDE, and when running the app from the compiled exe/pbd.
Each column (cbx1, cbx2, & cbx3) is data type number. Edit style: checkbox, 1 = on, 0 = off. Text is "One","Two","Three", respectively. The initial data value for each column is zero.
Protect expressions:
cbx1: If( cbx2 = 1 Or cbx3 = 1, 1, 0)
cbx2: If( cbx1 = 1 Or cbx3 = 1, 1, 0)
cbx3: If( cbx1 = 1 Or cbx3 = 1, 1, 0)
I also put a similar expression on the Font/Text color:
cbx1: If( cbx2 = 1 Or cbx3 = 1, RGB(192,192,192), 0) /* Light grey if protected, Black if not */
cbx2: If( cbx1 = 1 Or cbx3 = 1, RGB(192,192,192), 0)
cbx3: If( cbx1 = 1 Or cbx2 = 1, RGB(192,192,192), 0)
When I check one checkbox, the other two are protected. Only by un-checking the checkbox can I check one of the other two.
John
- Viktor Serguienkov
- Tuesday, 26 February 2019 22:20 PM UTC
I found my mistake. I had function that was overriding
-
Helpful Loading... Helpful 0
- John Fauss
- Tuesday, 26 February 2019 23:01 PM UTC
-
Helpful Loading... Helpful 0
- Page :
- 1
However, you are not allowed to reply to this question.
Here my scenario: I have 3 check boxes on line with value 1 for checked and 0 for unchecked. The goal is if one is checked other two to be protected. So in expression fro cb_3 i wrote: IF(cd_1=1 or cb_2=1,1,0) for other two the logic is the same. In design mode works perfectly fine but in run time expression is not applying