If you're loading a saved search and want to acces...
# suitescript
c
If you're loading a saved search and want to access multiple formula columns, do you always have to refer to the columns by their index number? They all have the same internal id/name so I assume yes. It seems like quite a brittle way to do it as someone could change the column index by introducing a new column.
c
yes
c
Damn...
c
Yeah its not the best but thats how you do it
s
can't you give a custom label to each formula column?
c
@stalbert I literally just thought of that and I'm testing it now - I think the answer is yes though
c
I believe i tried that in the past and it made me access via index no matter what after the 1st one
if it works, i'd be curious to see for sure
c
Copy code
formulanumeric: "2000",
      formulanumeric_1: "500"
That's what I see when I log the result
So it looks like the custom label doesn't work @stalbert @creece
message has been deleted
c
it may work with just 1 formula column just like you can access the formula fields if there's just 1 of the formula types
c
There's a few formula columns in this search though
c
Yeah i'm just saying it may work with 1 vs X. Column index is the way to go with X. It just sucks if someone messes with your search and re-orders something.
b
use search.createColumn to create the matching column
and use that column with getValue
s
or consider SuiteQL?