Why is this broken?
ClearCollect(NextDataItems,RenameColumns(FirstN(Filter(temporary_assign_wo,Updated<>2 And !IsBlank(_SNValve) ),Value(TextInput6.Text)),"SN_List","SN_List_Del"));
AddColumns(NextDataItems,"SN_List","d")
This works fine if I give the new column a different name.
I initially used DropColumns() but it resulted in the same issue. Renaming it out of the way doesnt work either.
Solved! Go to Solution.
Nope, I didnt. I ended up having to make a collection and doing the formulas in a separate ForAll(Collect()) nested function to get it done. Not my preference, but its a one-off activity, so it was good enough.
Thanks for your help.
ClearCollect(NextDataItems,
AddColumns(
DropColumns(
AddColumns(
FirstN(
Filter( temporary_assign_wo, Updated<>2 && !IsBlank(_SNValve) ),
Value(TextInput6.Text)
),
"SN_List_Del", SN_List
),
"SN_List"
),
"SN_List", "d"
)
);
@Alex_10 ,
Yep, thats what I did the first time. Same result. It is intuitively correct, but no workie.
Its all happy if I change the name... same issue. It MUST be the same name, so I can do a patch back to a SQL list with identical column names.
i suspect DropColums does not really deletes the column if datasource is SP, just hides it.
the only solution i have here is taking a full control over the result collection:
Clear(NextDataItems);
ForAll(
FirstN(
Filter( temporary_assign_wo, Updated<>2 && !IsBlank(_SNValve) ),
Value(TextInput6.Text)
) As ThisSN,
Collect(NextDataItems,
{
Title: ThisSN.Title,
SN_List_Del: ThisSN.SN_List,
SN_List: "d"
}
)
)
@Alex_10 ,
Yea, I was hoping to avoid that. There are like 25 columns. Thats a LOTTA stuff.
Well, anyway.
Thanks
Hi @martinav ,
This should work
With(
{
wList:
DropColumns(
temporary_assign_wo,
"SN_List"
)
},
ClearCollect(
NextDataItems,
AddColumns(
FirstN(
Filter(
wList,
Updated <> 2 And !IsBlank(_SNValve)
),
Value(TextInput6.Text)
),
"SN_List",
"d"
)
)
)
Note you have a Delegation limitation with Add/Drop columns but you already had that with both of your filter criteria and FirstN
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Another great idea. However, same result. It still thinks its there. I moved the filter around to make this a bit more simple where its broken.
With(
{
wList:
DropColumns(
FirstN(
Filter(
temporary_assign_wo,
Updated <> 2 And !IsBlank(_SNValve)
),
Value(TextInput6.Text)
),
"SN_List"
)
},
ClearCollect(
NextDataItems,
AddColumns(wList,"SN_List","d")
)
)
Result:
Same
Regarding delegation: Its true, but for this purpose, it does not affect the purpose for which I'm using this.
Hi @martinav ,
I actually thought that would work, however the long way . . .
ClearCollect(
colDrop,
DropColumns(
temporary_assign_wo,
"SN_List"
)
);
ClearCollect(
NextDataItems,
AddColumns(
FirstN(
Filter(
colDrop,
Updated <> 2 And !IsBlank(_SNValve)
),
Value(TextInput6.Text)
),
"SN_List",
"d"
)
);
Clear(colDrop)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
I've been down this avenue as well. I'm with you about the 'should work' situation. I suspect this must have something to do with the fact the data comes from an SQL Table? Well, if nothing makes sense, it something that doesnt make sense that is the explanation.
Hi @martinav ,
Got it to work with ShowColumns (RenameColumns fails too in SharePoint) in the first bit - and you are correct that it should work . . .
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
197 | |
67 | |
46 | |
41 | |
28 |
User | Count |
---|---|
254 | |
121 | |
84 | |
80 | |
73 |