Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

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

Sinhue
Level 2
Level 2

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.

 

1 Accepted Solution
Manoj_Kumar_
Correct answer by
Community Advisor
Community Advisor

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

 

 

View solution in original post

5 Replies
Manoj_Kumar_
Correct answer by
Community Advisor
Community Advisor

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

 

 

View solution in original post

Sinhue
Level 2
Level 2
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.
Manoj_Kumar_
Community Advisor
Community Advisor
You can use two query activites to replace your 2 sql queries and then use the enrichment to create a join on the basis of vin and in the output column of the enrichment you can add the difference and other columns
gunnark17854189
Level 2
Level 2
Sounds bad but use a Split - than the Script, than a Union 🙂 we have the same Problem. The performance is very bad...
Sukrity_Wadhwa
Employee
Employee

Hi @Sinhue,

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

Thanks!