I am loading a search in a map/reduce using search...
# suitescript
n
I am loading a search in a map/reduce using search.load -> the search contains multiple formula columns (like > 10) ... it seems that the results in the script are missing columns (context.value is missing columns). Anyone seen this before and how to get around it ?
b
make new columns copied from the old ones that have names like
formulatext_abc
n
thanks @battk so should I create the search in my script and then give them different names or is there a way to do that in the saved search UI so I can use search.load?
b
you can use the search.load, but still replace the columns if you really want
n
for example this is a snippet
in the UI is there a way to rename the formula columns?
@battk
b
no
is a bug
you need to make a support case to have the issue fixed
in the meantime, load the search, make copies of the columns, then replace the columns on the returned search
n
would it help if I do search.create and then number the columns?
and then call those
b
im not sure what you are trying to do
if you want to have someone be able to edit the search in the ui, then you need to use search.load
if you want to use formula columns in your map reduce, you need to create your own columns with named formulas
you can do both you need to load the search and use your own columns, which you can achieve by overwriting the coiumns on the loaded search
you can also make a new search instead of reusing the loaded search, it just requires you to also copy over the filters and in usual cases, the settings
n
hmm ok
I'm just trying to get all the values in the search (all the columns)
b
do you care about letting people edit the search in the ui?
n
not particularly
b
then just dont load the search
use your own filters and columns
n
and then number the columns I would assume
or just give them a name
b
its usually nicer to give them nice names
n
Copy code
search.createColumn({
          name: "enddate",
          summary: "GROUP",
          formula: "CASE WHEN {type} = 'Bill' THEN {custbodyrel_po.custbody_expected_payment_date} ELSE {custbody_expected_payment_date} END",
          label: "End Date"
        })
for example would this make sense?
instead of formula(text) I change the name
b
now its not a formula, netsuite did not implement formula type guessing
n
so where do I change the name?
b
what was my example?
n
formulatext_abc
so I guess it works if you keep the first part?
lol
b
correct, netsuite uses a prefix to determine what type of formula it is
n
very interesting
b
and was lenient enough to not require an exact match
n
amazing
b
that can change
n
it actually works
b
which is why you want to join the queue in the support case defect
n
so just open a case with ns about this?
b
yes
n
done
thanks for your help as always very valuable
s
another alternative is a scheduled script?