1. John Michael Tejano
  2. PowerBuilder
  3. Thursday, 20 July 2023 08:11 AM UTC

Good day!

I need help in my code in which I have this listview as shown below

What I want to achieve is that I want to go over each value of the listview and have the result to be formatted as:

"a_1,a_10,a_2,a_3,a_4,a_5,a_6,a_7,a_8,a_9"

So far I have this code:


Integer li_index=0
String ls_value

string ls_zone[]

string ls_result


FOR li_index = 1 to lv_1.totalitems( )

lv_1.GetItem(li, 1 , ls_value)

Messagebox("Value:",ls_value)

NEXT

 

Thank you in advance!

Accepted Answer
John Raghanti Accepted Answer Pending Moderation
  1. Thursday, 20 July 2023 11:51 AM UTC
  2. PowerBuilder
  3. # Permalink

You have a bug in your code in the GetItem call, you're using the variable li but it should be li_index based on the loop

 

String ls_value, ls_result
Integer li_index // Good to 32,765

FOR li_index = 1 to lv_1.totalitems( )
	lv_1.GetItem(li_index, 1 , ls_value)
	If ls_result = "" Then
		ls_result += ls_value
	Else
		ls_result += "," + ls_value
	End If
NEXT

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Thursday, 20 July 2023 08:19 AM UTC
  2. PowerBuilder
  3. # 1

How about adding this lines after GetItem call:

IF li_index > 0 THEN ls_result += ","
ls_result += ls_value
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.