1. David Vasconcelos
  2. PowerBuilder
  3. Saturday, 19 January 2019 13:41 PM UTC

I can't find any reference on how to do this, so it's either so simple I am missing it.  How can I search a column with edit style ddlb, on the data value (not display value).  Reason for this is. I get the original value for the column and now I need to get the display value for the data, original value brings back the code (data value).

 

Thanks in advance..

Dave.

Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 22 January 2019 20:57 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi David;

  You would expect that the following syntax would work ...

  • .Describe(".Edit.CodeTable.Values")     // OR
  • .Describe(".DDLB.CodeTable.Values")   

However, the Describe method syntax above is not supported for either the EDIT or DDLB column mode. Please feel free though to open a Support Ticket for this and request this as an "enhancement".

The other alternative of course is to convert the DDLB to a DDDW and then your App would have full access to the code table values using the GetChild + GetItem commands. Food for thought.

HTH

Regards ... Chris

Comment
  1. Brad Mettee
  2. Wednesday, 23 January 2019 14:46 PM UTC
Chris,

You can get the list of values from the column already, no enhancement needed.



'datawindow'.Describe("'colname'.values") - returns tab separated list of Data/Display values



Works for both Edit and DDLB column types.



(orig comment deleted. I tried to use what looked like an html tag to represent the colname, and it was removed during comment submission)
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 23 January 2019 19:56 PM UTC
Hi Brad;

Thanks for the "course" correction ... Works great! :-)

Close but no cigar!

Oh, oh ... Zzzzzzz ... more coffee! :-(

Regards ... Chris

  1. Helpful
  1. David Vasconcelos
  2. Wednesday, 30 January 2019 14:45 PM UTC
Brad, that's exactly what I ended up using...not pretty but it works.
  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Sunday, 20 January 2019 23:11 PM UTC
  2. PowerBuilder
  3. # 1


Do you mean searching a DDDW?
I think a DDLB has only one entry per row, while DDDWs have a DATA value and a DISPLAY value.

When you search a dddw, you ARE searching through the DATA value, not the display value.


datawindowchildl          ldwc_chapter
long                           ll_rc, ll_row, ll_data
string                         ls_display


ll_rc = dw_chapter.GetChild ("chapter_name", ldwc_chapter)
IF (ll_Rc = 1) THEN

   ll_row = ldwc_chapter.FIND (" = 4", 1, 9999)      // Display = "Dallas"
   IF (ll_row > 0)THEN

      //Correct row found.
      ll_data     = ldwc_chapter.GetItem (ll_row, )      // shoud be 4
      ls_display = ldwc_chapter.GetItem (ll_row, )   // shoud be "Dallas"

   END IF;

END IF;

Comment
  1. David Vasconcelos
  2. Tuesday, 22 January 2019 11:49 AM UTC
Olin, the dddw was the easy one as per your example email, but DDLB and radio buttons have two values... Display and Data, so I needed to get the display value when I only have the data value.
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Saturday, 19 January 2019 19:51 PM UTC
  2. PowerBuilder
  3. # 2

In this example from the help dept_id is the column and 5 is the row:

dw_1.Describe("Evaluate('LookUpDisplay(dept_id)', 5)")

 

Comment
  1. David Vasconcelos
  2. Sunday, 20 January 2019 15:02 PM UTC
Hi Roland, thanks for the info but this would not work in my situation. If I got the value from the Primary Buffer but it's the Orignal value not the one changed, that function would not work. That function would only be for the current value and not the original value. I did find a way around this, I was able to do a describe to get all the display and data values of a ddlb/radiobutton and I was able to "find" using POS function to find the display value based on the data value. Not the prettiest way but it works. The reason for this is I have some auditing that needs to be tracked. So I need to get the original value and the change value to insert into tables. Since columns can be codes vs actual descriptions I also need to capture the description (or Display value) and insert that into the table. Hope that makes sense... Dave V.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 22 January 2019 17:55 PM UTC
Hi David;

FWIW: If you query the DWO's "Original" buffer - you should get the DDLB's data from the initial SQL query.

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.