1. Michał Misijuk
  2. PowerBuilder
  3. Tuesday, 20 August 2019 05:49 AM UTC

Hi,
I have 2 columns in DW, both of them are DDDW
method and symbol

Method DDDW is like:

id(data_col)  method(disp_col)  symbol

1                  met_1                 X

2                  met_2                 X

3                  met_3                 Y


What I am trying to do is filter records in method column based on value in symbol column.
F.E. if symbol = 'X' then method DDDW contains only records where symbol also is 'X'

And I have no idea how to do it on row level, to be dynamically

Thanks!

Marco Meoni Accepted Answer Pending Moderation
  1. Tuesday, 20 August 2019 06:27 AM UTC
  2. PowerBuilder
  3. # 1

Hi Michal,

tricky point in your case is you cannot use 

dw_1.getItemString(row, 'symbol')

because 'X' is the *displayed value* instead of the *data value*.

So, you need to use the Evaluate + LookupDisplay functions. 
Put code below in the dataWindow rowfocuschanged event, so you trigger the filter only for the selected row:

datawindowChild ldwc
String displayedValue

dw_1.getChild('method', ldwc)
ldwc.setTransobject(sqlca)

displayedValue = dw_1.Describe("Evaluate('LookupDisplay(symbol)', " + String(currentrow) + ")")

ldwc.setFilter("symbol_column = '" + displayedValue + "'") 
ldwc.Filter()
ldwc.Retrieve()

Note that "symbol_column" is column in 1st DDDW where you have symbol's values.

In short, use GetChild() to get a reference to a DDDW, and use LookupDisplay() to capture displayed values instead of data values.

Best,

.m

Comment
  1. Michał Misijuk
  2. Tuesday, 20 August 2019 10:03 AM UTC
Hello Marco,

First - BIG thanks to You :) im close but i get an error



database transaction information not available,

call settrans or settransobject funciton.



but i'm calling it :o
  1. Helpful
  1. Michał Misijuk
  2. Tuesday, 20 August 2019 10:09 AM UTC
i uncomment ldwc.Retrieve(),

and now DW is filtering, but displayed column changed, now i see ID not f.e. met_1
  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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.