I am trying to add some columns to a collection using the AddColumns function. The second argument - Column Name - returns the error: "Column name already exists".
It has started happening recently. Previously the same code was working fine.
Here is the syntax:
Clearcollect(col_bills, AddColumns(Gallery.AllItems,"NewColumn", "TestVal"))
@sahana_23 That is not a valid Power Apps formula, the column name has to be a text literal - plus even if you could add a random value to the column name after every time you collect something, then you will never be able to refer to that column name in your App as it will change every time
Did you try this formula yourself or is this what the AI suggested - AI models are currently particularly bad at PowerFx, so I would not recommend using them for PowerFx
Hii, Can you use this formula and try it once,
ClearCollect(col_bills, AddColumns(Gallery.AllItems,"NewColumn" & Text(Rand()), "TestVal"))
Hi,
Problably you already have that column, if you want to override it, you can do this:
ClearCollect(col_bills, AddColumns(DropColumns(Gallery.AllItems,"NewColumn"),"NewColumn", "TestVal"))
But I suggest changing the name of NewColumn.
I hope it helps 🙂
WarrenBelz
146,780
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,093
Most Valuable Professional