What's another way other than writing every line 25 times? Any ideas?
If the value of Hours is blank, this should not go to the BACollect or SPList. How?
ClearCollect(BACollect,
{BU: DDBU.Selected.Value,Country:ddCountry.Selected.Value,Hours: Value(txtHour.Text)},
{BU: DDBU_1.Selected.Value,Country:ddCountry_1.Selected.Value,Hours: Value(txtHour_1.Text)},
{BU: DDBU_2.Selected.Value,Country:ddCountry_2.Selected.Value,Hours: Value(txtHour_2.Text)},
...
...
...
...
);
ForAll(BACollect,Patch('SPList',
Defaults('SPList'),
{
BU: {Value:BU, '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},
Country: {Value:Country, '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},
Hours: Hours
}
))
Solved! Go to Solution.
Hi @ruchiga ,
That looks like a lot of hard work
I assume you want to add some logic to the collection to exclude Blank() hours - and want to avoid having to add that logic to each line. If I'm correct, just wrap your collection in a filter as part of the ForAll Patch - something like this;
ForAll( Filter(BACollect, !IsBlank(Hours)), Patch('SPList', Defaults('SPList'), { BU: {Value:BU, '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"}, Country: {Value:Country, '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"}, Hours: Hours } ))
Hope this helps,
RT
Hi @ruchiga ,
That looks like a lot of hard work
I assume you want to add some logic to the collection to exclude Blank() hours - and want to avoid having to add that logic to each line. If I'm correct, just wrap your collection in a filter as part of the ForAll Patch - something like this;
ForAll( Filter(BACollect, !IsBlank(Hours)), Patch('SPList', Defaults('SPList'), { BU: {Value:BU, '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"}, Country: {Value:Country, '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"}, Hours: Hours } ))
Hope this helps,
RT
I will get back to you shortly about blank() today.
I have about 50 controls. I don't want to copy and paste and change the number like the below example. What's another way other than copying/pasting and changing 25 times? Is there any easy code for this like for loop?
ClearCollect(BACollect,
{BU: DDBU.Selected.Value,Country:ddCountry.Selected.Value,Hours: Value(txtHour.Text)},
{BU: DDBU_1.Selected.Value,Country:ddCountry_1.Selected.Value,Hours: Value(txtHour_1.Text)},
{BU: DDBU_2.Selected.Value,Country:ddCountry_2.Selected.Value,Hours: Value(txtHour_2.Text)},
...
...
...
...
);
User | Count |
---|---|
212 | |
94 | |
85 | |
49 | |
38 |
User | Count |
---|---|
271 | |
103 | |
102 | |
60 | |
59 |