Hi. I have a dataset in a table that contains a heading of ObjectID that i get from query1.
in query2 i have another data set that matches objectID to a name. 3412AE29F, "Straw Hat"
I want to create a custom column in the table for query1 that shows the name of that object that matches using query2
let res = [];
{{sfinventory.data.ObjectID}}.forEach(id => {
console.log({{getItemName.data.blankUIC}}.findIndex(id))
// res.push(what goes in here);
});
return res;
You can see i am starting to try to grab the entry but not getting far.
i want to push to the res array the getItemName.data.string for the match between query1.data.objectID === getItemName.data.blankUIC
javascript is a bit new to me coming from php side of things so i'd appreciate the help.
I got this to work, but i feel like there should be an easier way.
res.push({{getItemName.data.string}}[{{getItemName.data.blankUIC}}.findIndex(element => element === id)]);
Hey @dlbhilbig!
I think there are a bunch of ways you can do this, good to hear you already found one 
Here's one I like but it's totally up to preference!
const objectIDs = {{ sfinventory.data.ObjectID }};
const {string, blankUIC} = {{ getItemName.data }};
const findName = (id) => string[blankUIC.indexOf(id)];
return objectIDs.map(findName);
You can also stick JavaScript straight into your custom column, so you could do something like the following directly in the "Value" field of your custom column:
{{ getItemName.data.string[getItemName.data.blankUIC.indexOf(currentRow.ObjectID)] }}
1 Like
Thanks so much, i love the inline method, and implemented that. Coming from a php background, there is a lot of learning happening on the fly. I appreciate you!