Hello everyone, I have a NetSuite code that needs ...
# suitescript
a
Hello everyone, I have a NetSuite code that needs to apply some date filters to a record, but it doesn't seem to work properly. I did a small test and applied the same filter twice, one right below the other, and it gives me two different results. Do you know why this is happening? The code is
scriptData += '    let result1 = dataAlumnos;';
scriptData += '    console.log("dataAlumnos: ", dataAlumnos);';
scriptData += '    result1 = result1.filter((item) =>  item.values.formulatextinteger <= "20240611");';
scriptData += '    console.log("result1: ", result1);';
scriptData += '    result1 = result1.filter((item) =>  item.values.formulatextinteger <= "20240611");';
scriptData += '    console.log("result2: ", result1);';
. In the first iteration, it brings 2030 records and in the second, only 1056. Why is this happening?
😵‍💫 2
facepalm 1
b
what you are doing is not sane
😂 3
dont geneate a script in a string to be evaled
a
what do you recomend please?
b
dont know what you are using scriptData for, but the usual is to use an actual script file
e
Can you give us some context on where you're putting this code and how it is being executed?
a
@erictgrubaugh it is in a suitlet that have a html part too
b
part implies that you also are using serverWidget for the rest, which means you have access to Form.clientScriptModulePath for your javascript needs
a
yep but the question is why show me different record amount, for example this two logs show me this:🤯🤯
one amount for length one for the array🤯
b
you havent shared enough code for that, what you shared couldnt generate the logs you are generating
technically you havent even shared code, you are sharing strings, which means you arent getting code assistance from your code editor