Solved!
Hi! I have a Dynamic Dataset on my dynamic item page, and I want to grab the _id of the current item that is viewed.
How can I get the _id that is outputted, instead of the whole thing?
let itemObj = $w("#myDataset").getCurrentItem();
Solved!
Hi! I have a Dynamic Dataset on my dynamic item page, and I want to grab the _id of the current item that is viewed.
How can I get the _id that is outputted, instead of the whole thing?
let itemObj = $w("#myDataset").getCurrentItem();
$w("#dataset1").getCurrentItem().fieldName;
I already got it! I used this:
let itemObj = $w("#dynamicDataset").getCurrentItem();
This gives your output:
itemObj._id
And this tests it:
console.log(itemObj._id)
You can also use this code by @givemeawhisky:
let itemFieldName = $w("#dataset1").getCurrentItem().fieldName;
And this tests it:
console.log(itemFieldName)
Oh thanks! Already got it, just had to think one minute longer lol
@webmasterq
That is typical, most times the solutions are starring us right in our faces, like myself be dumb for five mins then go away and grab a cuppa and look again and there it is
xD
@givemeawhisky
What if that value is variable? Lets say that the user picks the desired field from a dropdown.
I tried this, but as it’s not that exact field name, it won’t work. Any suggestions?
let dropdownChoice = $w('#dropdown').value;
$w("#dataset1").getCurrentItem().dropdownChoice;