I have the below result, i want to the value of th...
# suitescript
v
I have the below result, i want to the value of the Bold one, how can i take that? could anyone please help, i tried .values, but no use {"values":{"GROUP(accountingTransaction.accountingbook)":[{"value":"1","text":"Local , Company"}],"GROUP(account)":[{"value":"179","text":"121212 Transfers"}],"SUM(amount)":"8.622","GROUP(posting)":true,"GROUP(memo)":"ABCDEF","GROUP(entity)":[{"value":"","text":"- None -"}],"GROUP(subsidiarynohierarchy)":"ABCE","GROUP(subsidiary.internalid)":[{"value":"16","text":"16"}],"GROUP(subsidiary.currency)":[{"value":"4","text":"EUR"}],"GROUP(line.cseg_jil_jall_div)":[{"value":"1","text":"Holding"}],"GROUP(departmentnohierarchy)":"- None -","GROUP(classnohierarchy)":"- None -","GROUP(location)":[{"value":"","text":"- None -"}],"MAX(formulatext)":"d","MAX(formulatext)_1":"Partially Matched","MAX(formuladatetime)":"18/4/2023 14:34","MAX(formulatext)_2":"","GROUP(type)":[{"value":"Journal","text":"Journal"}],"GROUP(internalid)":[{"value":"196","text":"196"}],"GROUP(line)":"1"}}
b
you havent shared enough context, so you get to pick out of the combination of possible answers: property accessors, JSON.parse, Result.getValue
v
its an object from the saved search
b
with the minimal amount of context you provided, you get a 4th option: Result.getValue(column)
s
the issue is always in the code, so we’d need to see the code, and possibly know the type of script, too. JSON says nothing, it could be getting exported to another app outside of NetSuite. But, the main issue you’ll likely face is that, in JavaScript, if your key has certain characters in it, like a dot or parentheses, then you have to enclose the full key in square brackets and quotes, either
myObject.values['*MAX(formulatext)*']
or
myObject.values["*MAX(formulatext)*"]
myObject.values.MAX(formulatext) won’t work, because JS will assume values contains a function named MAX, and try to execute that, and pass in a parameter called formulatext. Both will be undefined, and it will fail.
but also, as battk mentioned, if you have a search Result object, you just need to call getValue with the right parameters, and it will work. Again, without the code, it’s impossible for anyone to know.