Hi
How can I get a dropdown box to show me the column names as the items
So I'm looking for what formula I should use in my Items of the dropdown
Something like ShowALLcolumnamaes(Table1)
Thanks
Jese
Solved! Go to Solution.
Store the contents of Table1 inside a collection.
// collect the table values
ClearCollect(
colTable1,
Table1
);
// get the column headers
Set(
varColumnNames,
Distinct(
Ungroup(
MatchAll(
JSON(
colCarInventory,
JSONFormat.IgnoreBinaryData
),
"([^""]+?)""\s*:"
).SubMatches,
"SubMatches"
), Value)
)
Then use this code in the Items property of the dropdown to show the column names.
varColumnNames
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
When I use this code, @mdevaney , I get red squiggly lines under colCarInventory. It says it doesn't recognize the name. Should it have the same name as the colTable1 or am I missing something?
@HEATFreight may I ask to see how you managed to get it to work?
@shavora I'm not sure if that's a typo in @mdevaney's code or what, but you need colCarInventory to be an existing collection.
Sounds like you just copied and pasted the code without first editing it for your specific situation.
If you replace colCarInventory in that code with colTable1, or vice versa, and if whichever collection you're using exists and has data stored in it, then the code will produce a list of column headers in varColumnNames. You can't feed it an empty or nonexistent collection.
You are getting the red squiggly line with "unrecognized name" error because you are trying to use a collection name which doesn't yet exist in your app.
@HEATFreight I changed the first one to fit my situation, but for the colCarInventory, I wasn't certain it should refer to an existing one from the description for the provided solution. Hence the question 🙂