1. Raymond Longoria
  2. PowerBuilder
  3. Tuesday, 25 July 2023 00:50 AM UTC

I have a datawindow with 2 groups. There is a computed field in each of the trailer groups. I am trying to access the values in each computed field but I keep getting an error. The documentation said to reference the group number. How is my syntax incorrect?:

 

ldec_tmp1 = dw_1.Object.c_section_total[2]
ldec_tmp2 = dw_1.Object.c_proposal_total[1]

 

Accepted Answer
Raymond Longoria Accepted Answer Pending Moderation
  1. Wednesday, 26 July 2023 00:13 AM UTC
  2. PowerBuilder
  3. # Permalink

I am closing this question. The syntax works if you have rows in the datawindow. I found a subsequent filter that removed all of the rows and thus led to the error.

Comment
There are no comments made yet.
Raymond Longoria Accepted Answer Pending Moderation
  1. Tuesday, 25 July 2023 17:43 PM UTC
  2. PowerBuilder
  3. # 1

I used Getitemdecimal and I am still getting an error. How is my syntax incorrect?

ldec_tmp2 = dw_1.Getitemdecimal(1, "c_proposal_total")

Comment
  1. Raymond Longoria
  2. Tuesday, 25 July 2023 23:56 PM UTC
I am posting the following from the Powerbuilder documentation. If I read this correctly, I am supposed to put the group number in the brackets if the computed field is in the group trailer. Am I misunderstanding the documentation?



When you refer to a control in a band other than the detail band (usually a computed field) you still specify a row number. For the header, footer, or summary, specify a row number of 1. For the group header or trailer, specify the group number:



dw_1.Object.avg_cf[1]

  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 25 July 2023 05:34 AM UTC
  2. PowerBuilder
  3. # 2

I'm not sure but I think you can only access column data this way because it is a direct access to the data buffer.

To access values of computed fields you can use the GetItemxxx methods.

To get the value of a specific group you have to specify the number of a row for this group.

Depending on the expression in your computed field each row of a group may have the same value (e.g. for sum function) or different values (e.g. for cumulativesum function). So you have to check for what row you want the value (e.g. last row of a group).

HTH,

René

Comment
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.