function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AhlomonAhlomon 

I am getting the data but data is wrong...

Would you please tell me what I am doing wrong here? I am getting the data but the data is wrong (in red)
 
=============================================================================

queryString = "Select Id,Name,CreatedDate,CreatedById,Status__c,Service_Date__c,Hr__c from IS_TSR__c"

Dim done As Boolean = False

Try

qr = binding.query(queryString)

If qr.size > 0 Then

While Not done

'**********************************************

For i = 0 To qr.records.Length - 1

Dim tsr_data As sforce.IS_TSR__c

tsr_data = qr.records(i)

 

TSR_ID_arr.Add(tsr_data.Id)

TSR_NAME_arr.Add(tsr_data.Name)

TSR_CREATION_DATE_arr.Add(tsr_data.CreatedDate)

TSR_CREATED_BY_ID_arr.Add(tsr_data.CreatedById)

TSR_STATUS_arr.Add(tsr_data.Status__c)

TSR_RUN_DATE_arr.Add(tsr_data.Service_Date__c)

TSR_TIME_SPENT_arr.Add(tsr_data.Hr__c)

'*******************************************************************************************************

objWriter.WriteLine(TSR_ID_arr.Item(i).ToString & "|" & TSR_NAME_arr.Item(i).ToString & "|" & _

TSR_CREATION_DATE_arr.Item(i).ToString & "|" & TSR_CREATED_BY_ID_arr.Item(i).ToString & "|" & _

TSR_STATUS_arr.Item(i).ToString & "|" & TSR_RUN_DATE_arr.Item(i) & "|" & _

TSR_TIME_SPENT_arr.Item(i) & "|" & entryDt)

'*******************************************************************************************************

Next

If qr.done Then

done = True

Else

qr = binding.queryMore(qr.queryLocator)

End If

End While

werewolfwerewolf
In what way is it wrong?
AhlomonAhlomon
The total number of rows is right, but the data itself is wrong ( in red i noticed), and my guess is I am doing something wrong with the querymore function because I have 3555 rows to process. If I am processing less than 2000 rows I am fine but if it's more that 2000 rows wrong data produced
werewolfwerewolf
Yes, you highlighted it in red, but what about it is wrong?
AhlomonAhlomon
what I noticed that the TSR_RUN_DATE_arr.Item(i) don't go after 1/11/2008 but I know there is data
after 1/11/2008
werewolfwerewolf
The problem is just in your WriteLine.  It's inside a loop that is iterating between 0 and 1999 repeatedly, so all it's going to output are those rows between 0 and 1999, even though you're actually storing much more than that in the arrays.  Try breaking the writeline out of the loop and making a separate loop afterwards to iterate on it using the length of one of your arrays.
AhlomonAhlomon

Werewolf you are exactly right. As soon as I put writeline into separate loop I am getting the good data. Thank you very much for your help.