1. Keeley Stalnaker
  2. PowerBuilder
  3. Tuesday, 9 February 2021 17:52 PM UTC

Hello;

I am working on a PB app that has existed peacefully for some time, but now needs some new info added to a report. I created an Oracle function to get this value. The function is working fine, kicked off by a button clicked event of a window that gets a bunch of parameters from the user and then opens the report datawindow. I am assigning the function's return value to a variable and passing it to my report via OpenWithParm.

I created a static text box and assigned the value (in the window open event) to the report using DataWindowName.Object.Textboxname.Text = thevariable. This works fine for display only. However, is there a way I could use this value in a computed expression? I want to add it to the value of a column that is already on the report, coming from an SQL select data source.

 

Thank you for any advice for this PB newb! cool

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 9 February 2021 19:07 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi, Keeley -

In the expression for the computed field, try using the Describe DataWindow expression function to obtain the text value in the Text DataWindowObject. For example, if the Text DWO is named t_new_value, then a computed field expression like:

existing_column_object_name + Describe('t_new_value.Text')

should append the content of the Text DWO to the data value contained in the column DWO named existing_column_object_name.

Regards, John

Comment
There are no comments made yet.
Marco Meoni Accepted Answer Pending Moderation
  1. Tuesday, 9 February 2021 19:00 PM UTC
  2. PowerBuilder
  3. # 1

Hi,

you can use Describe() method, which is also available as datawindow expression function. 

Therefore you can use it in compute fields, for example:

Describe("textboxname.text")

Best,

.m

Comment
There are no comments made yet.
Keeley Stalnaker Accepted Answer Pending Moderation
  1. Tuesday, 9 February 2021 19:49 PM UTC
  2. PowerBuilder
  3. # 2

Thank you Marco & John for the quick responses! Describe() does almost what I was attempting, but I actually want to add the number in my text field to the number from the column and display the total, rather than just append. The datatype of the column is a number and the value from the text box is a string datatype.

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 9 February 2021 20:13 PM UTC
  2. PowerBuilder
  3. # 3

In that case, wrap the Describe() function (which returns a string) in a number conversion function such as Integer(string), Dec(string), Long(string), Real(string), depending on the type of numeric value you will be adding to the converted string. For example:

Long(Describe('t_new_value.text'))

 

Comment
  1. Keeley Stalnaker
  2. Tuesday, 9 February 2021 20:33 PM UTC
Thank you! That worked exactly as needed. I was having trouble with the syntax and you helped me tremendously.
  1. Helpful
  1. John Fauss
  2. Tuesday, 9 February 2021 20:49 PM UTC
You're welcome! Happy to help... Good luck!
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 9 February 2021 20:25 PM UTC
  2. PowerBuilder
  3. # 4

Hi Keeley;

  I would add the Oracle Function value as a "Retrieval Argument" to the DW object. Then just pass the RA into the DW Control / DataStore's Retrieve() command. The DW Object within the DC/DS can then use the value of the new RA for its own processing purposes (does not have to be SQL related). Thus, it can be used in a computed column, DWO expression, Child DWO, etc. as you require.

Food for thought.

Regards ... Chris

Comment
  1. Keeley Stalnaker
  2. Tuesday, 9 February 2021 20:38 PM UTC
Thank you, Chris! I will take a look at that as well.
  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.