1. Bhanu Prakash
  2. PowerBuilder
  3. Friday, 5 October 2018 20:20 PM UTC

Thanks for the people who helped me to get the issue resolved for my previous post.

 

INTEGER ll_certificate_id

lds_data = Create DataStore

lds_data.dataobject = 'd_revoke_certificate_hhg'
lds_data.SetTransObject(SQLCA)

ll_total_rows = lds_data.Retrieve()

FOR ll_row_count = 1 TO ll_total_rows

ls_policy_message = ""

//==============================================================================================
// Window - user info and Progress bar management
//==============================================================================================
of_update_status("Working on Form H " + Trim(String(ll_row_count)) + " of " + String(ll_total_rows))

ll_certificate_id = lds_data.GetItemNumber(ll_row_count, "certificate_id")

The result set from the datawindow should be the below certififcate id's. 

2008506173
2008501793
2008477186
2008477185
2008477184
2008477183
2008477182
2008477181
2008477180
2008477179

Issue : The GetItemNumber is returning negative number that is not in the actual resultset of the datawindow.

When I do Quickwatch it shows me the correct number  as "2008506173" 

lds_data.GetItemNumber(ll_row_count, "certificate_id")

 

but when the value is getting assigned to the ll_certificate_id its showing me as negative number which is not even in the resultset.

 

Why is the negative number showing in debug mode ?

 

Can you please help me out from this issue ? It started doing recently and it was working fine earlier.

 

your help is highly appreciated !!!

 

Accepted Answer
Roland Smith Accepted Answer Pending Moderation
  1. Monday, 8 October 2018 14:16 PM UTC
  2. PowerBuilder
  3. # Permalink

Because the integer variable is too small so when you assign too large a value to it, it wraps around to the negative.

Just change the datatype to LONG and it will work as expected.

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Friday, 5 October 2018 20:34 PM UTC
  2. PowerBuilder
  3. # 1

ll_certificate_id should be defined as LONG, not INTEGER.

The integer datatype has a value range of -32768 to +32768.

Also, ll_ is the usual prefix for 'local long'.

Comment
There are no comments made yet.
Bhanu Prakash Accepted Answer Pending Moderation
  1. Friday, 5 October 2018 21:22 PM UTC
  2. PowerBuilder
  3. # 2

Thank you for your response Smith!

In my post I just gave some dummy value "2008506173" saying the resultset holds this value but the getitemnumber returns negative value.

 

My actual values are  the below ones.

 

18953
18950
18476
18450
18419
17998
17797
17637
17375
16975
16713

But the getitemnumber returns the below values which are not even in the resultset

-47
-135
-231
-347
-640
-739
-812
-965
-1031
-1270
-1305
-1395

 

Please suggest

Comment
  1. Brad Mettee
  2. Saturday, 6 October 2018 12:51 PM UTC
Roland's answer is still the correct one. Your declared data type is too small to hold the value.

Use a Long or ULONG to hold your identifier and your code should work fine.

  1. Helpful
There are no comments made yet.
Bhanu Prakash Accepted Answer Pending Moderation
  1. Tuesday, 9 October 2018 17:07 PM UTC
  2. PowerBuilder
  3. # 3

Thank you Roland! It's working now!

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.