1. Tomas Beran
  2. PowerBuilder
  3. Friday, 29 September 2023 12:41 PM UTC

Hi

I' looking for fulltext search function in datawindow. The idea is something similar to Ctrl+F in Excel.

What I do is:

ls_data = datawindow.data //get full data buffer separated with ~t for cols and ~r~n for rows
ll_found = pos( ls_data, ls_lookFor ) //look for abs. position in the buffer
ll_row = of_countoccurrences(ls_data,"~r~n",ll_found) //calculate the row
//calculate the col in the similar way
...

This solution is quick and mostly working. It doesn't work with dropdowns but it's expected and there are mostly no scenarios where you want search in dropdowns. The main problem is that data can contain tabs or end of lines. It's rare but in this case my solution fails.

I've found a workaround. If I add a dummy column as the last column of the datawindow which such unique value then I can count these values follower with "~r~n". It works well but having a solution which doesn't require additional column would be better.

John Fauss Accepted Answer Pending Moderation
  1. Friday, 29 September 2023 13:31 PM UTC
  2. PowerBuilder
  3. # 1

Hi, Tomas -

Perhaps a variation of the technique you are using might work for you:

1. Create a DataStore and assign to it the same DataObject used in the DW that is to be searched.
2. For each row in the DW:
   a. Reset (clear) the DataStore.
   b. Use RowsCopy to copy the next, single row from the DW to the DataStore.
   c. Search the "entire" (the single row in the) DataStore via the technique you've developed.
   d. Repeat until a match is found.
3. Destroy the DataStore.

Best regards, John

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 29 September 2023 14:42 PM UTC
  2. PowerBuilder
  3. # 2

Hi Tomas;

  Have you tried the DW Control / DataStore FIND() command for this search requirement?

Regards ... Chris

Comment
There are no comments made yet.
Tomas Beran Accepted Answer Pending Moderation
  1. Friday, 29 September 2023 17:50 PM UTC
  2. PowerBuilder
  3. # 3

Hi Chris

I'm not sure what you mean and of course there's a chance I'm overlooking something. Imagine situation there are hundreds of columns in the datawindow. Using Find() requires (I think) specifying columns, casting to correct datatype etc. I'm afraid this solution will result with extremely long searching formulas. For column based searching I use enhanced PFC dwsearch dialog.

On the opposite side the Datawindow.data solution is super-fast. Regardless number of columns or number of rows. I can search the datawindow online (a user is writing the text and I'm searching in the background and it works). The only limit is that rows and columns separator which can be used in DW textfields.

Comment
  1. Chris Pollach @Appeon
  2. Friday, 29 September 2023 18:06 PM UTC
Hi Tomas;

Thanks for the feedback on your decision not to use the Find() command. Your implementation alternative is most interesting.

Thanks for that perspective!

Regards ... Chris

  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.