SqlSelect Function Javascript doesn't retrieve above 70000 rows. is that possible? | Community
Skip to main content
Level 2
Oct 13, 2020 3:59 PM UTC
Solved

SqlSelect Function Javascript doesn't retrieve above 70000 rows. is that possible?

Hi everyone 

 

I have this javascript code after an enrichment activity:

// select rows of the last transition var sql = "SELECT sVin,sMktSale,iCountVehicles,sDayDifference,tsDelivery,coalesce(tsDelivery - lag(tsDelivery) over(partition by sCustomerId order by tsDelivery), 0) as Difference FROM " + vars.tableName; var contracts = sqlSelect("resultQuery,@vin:string,@MktSale:string,@CountVehicles:int,@DayDifference:string,@deliveryDate:date,Difference:string", sql); // // Iterate each row for each(var contract in contracts.resultQuery){ var newString = contract.Difference; var sql = "UPDATE "+ vars.tableName + " SET sDayDifference='"+newString.toString()+"' WHERE sVin='"+contract.@vin.toString()+"'"; //logInfo('Executing '+sql); sqlExec(sql); }

 

the code works only if the enrichment activity has below 70000 rows but if the activity has above 70000 rows the contracts.resultQuery variable print undefined and the update statement doesn't execute.

 

Could you help me to understand what is the reason? is there a limit of rows to execute that command?

 

I really appreciate if you could help me.

 

Thanks.

SL.

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
_Manoj_Kumar_
_Manoj_Kumar_Accepted solution
New Participant
Oct 13, 2020 4:29 PM UTC

Helo @sinhue ,

 

I know queryDef is limited to 10000 rows by default. Similarly, I believe sqlSelect is also limited to 70,000 so that you won't run out of memory.

 

Also, My suggestion would be to use enrichment instead of javascript because it would be more efficient and you won't get this error with enrichment.

 

Thanks.,

Manoj

 

 

     Manoj     Find me on LinkedIn

6 replies

Sukrity_Wadhwa
Employee
Oct 26, 2020 8:16 AM UTC

Hi @sinhue,

Were you able to resolve this query with the given solution? Do let us know.

Thanks!

Translate
Sukrity Wadhwa
_Manoj_Kumar_
_Manoj_Kumar_Accepted solution
New Participant
Oct 13, 2020 4:29 PM UTC

Helo @sinhue ,

 

I know queryDef is limited to 10000 rows by default. Similarly, I believe sqlSelect is also limited to 70,000 so that you won't run out of memory.

 

Also, My suggestion would be to use enrichment instead of javascript because it would be more efficient and you won't get this error with enrichment.

 

Thanks.,

Manoj

 

 

Translate
     Manoj     Find me on LinkedIn
SinhueAuthor
Level 2
Oct 13, 2020 5:08 PM UTC
Hi @_manoj_kumar_ thanks for you answer, but how can I do that?, the purpose of my javascript code is to get the date difference between rows.
Translate