1. Viktor Serguienkov
  2. PowerBuilder
  3. Monday, 25 February 2019 23:29 PM UTC

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.

John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 26 February 2019 19:59 PM UTC
  2. PowerBuilder
  3. # 1

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

Comment
  1. Viktor Serguienkov
  2. Tuesday, 26 February 2019 22:20 PM UTC
Thanks.

I found my mistake. I had function that was overriding
  1. Helpful
  1. John Fauss
  2. Tuesday, 26 February 2019 23:01 PM UTC
Glad to hear you found the problem!
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 26 February 2019 16:52 PM UTC
  2. PowerBuilder
  3. # 2

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

Comment
  1. Viktor Serguienkov
  2. Tuesday, 26 February 2019 17:11 PM UTC
there is only one instance
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 26 February 2019 19:22 PM UTC
Thanks Viktor for that confirmation.



Is the DWO's "expression" static (via DW painter) or dynamic (added at run-time)?
  1. Helpful
There are no comments made yet.
Viktor Serguienkov Accepted Answer Pending Moderation
  1. Tuesday, 26 February 2019 14:37 PM UTC
  2. PowerBuilder
  3. # 3

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

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 26 February 2019 01:34 AM UTC
  2. PowerBuilder
  3. # 4

It would help if you told us what the expression is.

Comment
  1. Viktor Serguienkov
  2. Tuesday, 26 February 2019 15:42 PM UTC


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
  1. Helpful
  1. Kevin Ridley
  2. Tuesday, 26 February 2019 19:08 PM UTC
Double check that you put the expression in the Protect attribute. Maybe you put it in a different attribute of the column?
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.