Need help with proper verbiage to add a new column to existing collection. Tried to patch and addColumn but get an error for each.
Collection is colIndicators
Want to add new column called colRiskFactorsPhysicalHealth and populate with values of listbox lbRiskFactorsPhysicalHealth
This is what I have currently:
Collect(colIndicators,
AddColumns(colIndicators,"colRiskFactorsPhysicalHealth",Concat(lbRiskFactorsPhysicalHealth.SelectedItems, Value & ",")))
Think I have punctuation out of place somewhere.
Thx for any help!!!
Solved! Go to Solution.
Hi @slhangen :
Adding a new column to an existing collection is more difficult. There are two reasons:
My plan is to add a temporary record containing the colRiskFactorsPhysicalHealth column to the collection, and then delete this record during execution. In this way, you can cleverly add a new column to the specified collection.For example:
Collect(colIndicators,{colRiskFactorsPhysicalHealth:"temporary record"});/*colIndicators adds an auxiliary record for adding ‘colRiskFactorsPhysicalHealth’ column*/
RemoveIf(colIndicators,colRiskFactorsPhysicalHealth="temporary record");/*Delete auxiliary records*/
UpdateIf(colIndicators,IsBlank(colRiskFactorsPhysicalHealth),{colRiskFactorsPhysicalHealth:Concat(lbRiskFactorsPhysicalHealth.SelectedItems, Value & ",")})/*Update all ‘colRiskFactorsPhysicalHealth’ columns*/
Best Regards,
Bof
Hi @slhangen ,
The first issue I can see is the repetition of colIndicators. The second reference of this needs to be replaced with the data source you are collecting from (you have to add columns to existing data). If that is not the issue, happy to assist further.
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.
Thank yo for your response. I am very confused.
Maybe spelling out the end result I am looking for will get me going in the right direction:
Just not sure how to write it. Thx again!
Hi @slhangen ,
The Collect bit at the start had me assuming you were adding records to the collection, therefore it had to come from data somewhere. If you simply want to ad a column (with the same value in each row), you do not need the Collect at the start.
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.
Yes sir, you were correct initially.
I do want to add to the column with the value created by the following formula:
Concat(lbRiskFactorsPhysicalHealth.SelectedItems, Value & ",")
Hi @slhangen ,
It depends where you are putting this formula - for instance as the Items of a gallery
AddColumns(
colIndicators,
"colRiskFactorsPhysicalHealth",
Concat(
lbRiskFactorsPhysicalHealth.SelectedItems,
Value & ","
)
)
would add a column to the collection with each item the same ( a comma-delimited list of the items selected in your combo box). Is this what you are trying to do?
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.
Hi @slhangen :
Adding a new column to an existing collection is more difficult. There are two reasons:
My plan is to add a temporary record containing the colRiskFactorsPhysicalHealth column to the collection, and then delete this record during execution. In this way, you can cleverly add a new column to the specified collection.For example:
Collect(colIndicators,{colRiskFactorsPhysicalHealth:"temporary record"});/*colIndicators adds an auxiliary record for adding ‘colRiskFactorsPhysicalHealth’ column*/
RemoveIf(colIndicators,colRiskFactorsPhysicalHealth="temporary record");/*Delete auxiliary records*/
UpdateIf(colIndicators,IsBlank(colRiskFactorsPhysicalHealth),{colRiskFactorsPhysicalHealth:Concat(lbRiskFactorsPhysicalHealth.SelectedItems, Value & ",")})/*Update all ‘colRiskFactorsPhysicalHealth’ columns*/
Best Regards,
Bof
User | Count |
---|---|
254 | |
106 | |
92 | |
47 | |
37 |