1. Larry Pettit
  2. PowerBuilder
  3. Wednesday, 26 June 2024 16:52 PM UTC

if(approved_day_13='N' ,255,16777215)

 

I have the above expression in a column of a datawindow that looks at the value in the approved_day_13 column and then sets the background color to red or white.  It works fine when i retrieve the datawindow.

However, if I programmatically in PowerScript change the value in the approved_day_13 column using SetItem(), the background color doesn't change until I save and re-retrieve the datawindow.  Shouldn't the expression re-evaluate when a referenced column changes?

Assuming this isn't going to get "fixed" anytime soon, is there a workaround?

Somebody else apparently had a similar problem about 6 years ago.

https://stackoverflow.com/questions/50498808/powerbuilder-datawindow-expression-changes-not-reflected-until-reopen-of-object

 

 

 

Accepted Answer
Larry Pettit Accepted Answer Pending Moderation
  1. Friday, 28 June 2024 21:17 PM UTC
  2. PowerBuilder
  3. # Permalink

I wasn't able to create a simple reproducible scenario.  Every time I tried, it worked (couldn't reproduce issue in simple example).

However I was able to find a workaround.  After doing the Setitem(), I use Modify to reset the expression:

ls_return = this.Modify(ls_columnname + ".background.color=~"16777215~tif(approved_day_13=~~'N~~' ,255,16777215)~"")

It doesn't seem like I should have to do this but it seems to work.

Comment
  1. John Fauss
  2. Friday, 28 June 2024 21:25 PM UTC
Glad to hear you were able to find a solution, Larry. Thanks for letting us know the details!
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 26 June 2024 19:14 PM UTC
  2. PowerBuilder
  3. # 1

Hi Larry;

  Have you tried calling the GroupCalc method right after the SetItem() update?

Regards .. Chris

Comment
There are no comments made yet.
Larry Pettit Accepted Answer Pending Moderation
  1. Wednesday, 26 June 2024 19:34 PM UTC
  2. PowerBuilder
  3. # 2

Since the datawindow has no groups, I had not tried calling GroupCalc().  I tried it just now, as you suggested, and it made no difference.

Comment
  1. Chris Pollach @Appeon
  2. Wednesday, 26 June 2024 20:00 PM UTC
Thanks for trying that command. It's basically like a "refresh" request in MS-Windows File Explorer.

What version & build of PB are you using?
  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 27 June 2024 06:07 AM UTC
In addition, you can also do a Setredraw(true) or a sort() command.
  1. Helpful
  1. Larry Pettit
  2. Thursday, 27 June 2024 12:35 PM UTC
I have also tried Setredraw(false) prior to the setitem and Setredraw(true) after the setitem. Still not working.
  1. Helpful
There are no comments made yet.
Larry Pettit Accepted Answer Pending Moderation
  1. Wednesday, 26 June 2024 20:08 PM UTC
  2. PowerBuilder
  3. # 3

PB 2022 R3

Comment
  1. Chris Pollach @Appeon
  2. Wednesday, 26 June 2024 20:31 PM UTC
Hi Larry;

If you have a simple PB App test case that uses that same DWO and can replicate your issue, please open a support ticket.

Then attach your test case to the ticket for Appeon to evaluate.

Regards .. Chris
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 26 June 2024 20:20 PM UTC
  2. PowerBuilder
  3. # 4

Hi, Larry - 

Does the approved_day_13 column have input focus when the other column's value is programmatically changed? If so, you are not seeing the approved_day_13 column DWObject, but instead are looking at the DW's dynamic edit control that gets superimposed over the column.

Best regards, John

Comment
There are no comments made yet.
Kai Zhao @Appeon Accepted Answer Pending Moderation
  1. Thursday, 27 June 2024 02:36 AM UTC
  2. PowerBuilder
  3. # 5

Hi Larry,

Please open a support ticket in the support portal and please provide a simple PB case to reproduce the issue to us for more study, Many thanks in advance.

https://www.appeon.com/standardsupport/

Regards,
Kai

Comment
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.