1. Kim Berghall
  2. PowerBuilder
  3. Friday, 25 May 2018 16:36 PM UTC

Is there a way to filter on the raw datawindow rowid? I don't want the row number because it changes when you sort etc. I know you can get the rowid by using GetRowFromRowId, but i would like to have a simple filter like this: rowid in (1,5,7,9,25). I don't want to add my own dummy rowid column, I want to use the rowid that already exists on the native datawindow, but how do you access it?

Accepted Answer
Kim Berghall Accepted Answer Pending Moderation
  1. Tuesday, 29 May 2018 17:28 PM UTC
  2. PowerBuilder
  3. # Permalink

It ends up working with the rownumber:

Here is the code using PFC, I'll fancy up the code and create a service for this - very slick capability.

It is super fast too.

---

long   ll_qty,ll_row, ll_Selected[]
string ls_filter
 
IF IsValid(dw_report.inv_RowSelect) THEN
ll_Qty = dw_report.inv_RowSelect.of_SelectedCount( ll_Selected)
END IF
 
ls_filter = 'getrow() in ('
 
for ll_row = 1 to ll_qty
if ll_row = 1 then
   ls_filter = ls_filter + string(ll_selected[ll_row])
else
ls_filter = ls_filter + ','+string(ll_selected[ll_row])
end if
next
ls_filter = ls_filter + ')'
 
dw_report.setfilter(ls_filter)
dw_report.filter()
Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Saturday, 26 May 2018 15:15 PM UTC
  2. PowerBuilder
  3. # 1

Depending on the database you are using, you might be able to have a rowid in the resultset itself.

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 25 May 2018 18:36 PM UTC
  2. PowerBuilder
  3. # 2

Hi Kim;

FYI ....

  • long ll_rowid
  • ll_rowid = dw_emp.GetRowIDFromRow (dw_emp.GetRow())

HTH

Regards ... Chris

Comment
  1. Kim Berghall
  2. Friday, 25 May 2018 19:44 PM UTC
Yes, but how do I filter on that ID?

  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 25 May 2018 20:19 PM UTC
Unfortunately Kim, the GetRowIDFromRow function is not available in the DWO as one that you can use within an expression. Thus, you would need to:





Create a Global Function that uses the GetRowIDFromRow method and expects the Row # as an argument

Create a dummy RowID computed column in your DWO`s SQL

Call the external Global Function using the DWO`s expression GetRow() method to return the RowID from the global function to populate the dummy SQL column in the DWO`s primary buffer. Or do the same in the RetrieveRow event and then do a SetItemXxxx () from there.





Now you can filter on the RowID using the dummy 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.