My goal for this is that the gallery shows you this default value, then you update as needed and it will patch it to the collection, then concat it to a string and push to the column. This part works well, took me a while to get the updating done but it works. It's the loading back into the gallery that's causing me a whole world of pain. For some reason, it will split the string as required but only push out one value to the collection. I've tried moving the Clear Collect to inside the forAll and vice versa but nothing seems to work. I've been stuck on this for about a month now.
This is default value In the column as well as the value that gets patched and concatenated into a string.
2.0 cubic foot box - small|0|2.9|0|0$4.0 cubic foot box - large||4.9|0|0$Wardrobe tall box||23.5|0|0$Large Mirror/Picture||14|0|0$Small Mirror/Picture||39|0|0$Single/Full Mattress Bag||7.5|0|0$Queen Mattress Bag||10|0|0$King Mattress Bag||14|0|0$Sofa Plastic Cover||10|0|0$Chair Plastic Cover||9|0|0$Shrink Wrap||37.5|0|0$Bubble Wrap||45|0|0$Tape||2|0|0$Packing Paper||45|0|0
This is my function.
ClearCollect(
packMatList,
ForAll(
Split(
selectedItem.'Packing Materials List',
"$"
),
{
item: Last(FirstN(Split(Result, "|").Result, 1).Result).Result,
quantity: Value(Last(FirstN(Split(Result, "|").Result, 2).Result).Result),
unitPrice: Value(Last(FirstN(Split(Result, "|").Result, 3).Result).Result),
discount:Value(Last(FirstN(Split(Result, "|").Result, 4).Result).Result),
total: Value(Last(Split(Result, "|").Result).Result)
}
)
);
What it should look like VS. What it looks like
Solved! Go to Solution.
I found the issue, the quantity fields were Blank() so it didn't update properly
@Anonymous
I just tested your code and it worked for me. What I did was set a variable to your string, ie
Set(
vTestStr,
"2.0 cubic foot box - small|0|2.9|0|0$4.0 cubic foot box - large||4.9|0|0$Wardrobe tall box||23.5|0|0$Large Mirror/Picture||14|0|0$Small Mirror/Picture||39|0|0$Single/Full Mattress Bag||7.5|0|0$Queen Mattress Bag||10|0|0$King Mattress Bag||14|0|0$Sofa Plastic Cover||10|0|0$Chair Plastic Cover||9|0|0$Shrink Wrap||37.5|0|0$Bubble Wrap||45|0|0$Tape||2|0|0$Packing Paper||45|0|0"
)
then, ran your code using this variable, ie
ClearCollect(
packMatList,
ForAll(
Split(
vTestStr,
"$"
),
{
item: Last(FirstN(Split(Result, "|").Result, 1).Result).Result,
quantity: Value(Last(FirstN(Split(Result, "|").Result, 2).Result).Result),
unitPrice: Value(Last(FirstN(Split(Result, "|").Result, 3).Result).Result),
discount:Value(Last(FirstN(Split(Result, "|").Result, 4).Result).Result),
total: Value(Last(Split(Result, "|").Result).Result)
}
)
);
And get a full collection:
So not sure what's happening at your end? My guess is that you data isn't being recognised as a String. Maybe try setting it to a variable like I do and try again?
I tried your solution and sadly it didn't work outside the Power Apps environment. Everything works smoothly inside Power Apps but once I test it on Share Point, it fails.
@Anonymous
So, are you wanting to embed this app into your SP site and run it from the site?
If this isn't the case, then I'd say you have a Data Type mismatch somewhere and the first place to look would be the column type you are sending data to.
I found the issue, the quantity fields were Blank() so it didn't update properly
@Anonymous
So have you sorted your own issue? If so, make your answer as the solution and if possible provide some details about your solution. This will just help future, similar searches by other PA users.
Hi @Anonymous ,
Have you solved your problem?
Based on the formula that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. Please also consider try the following formula:
ForAll(
Split(
selectedItem.'Packing Materials List',
"$"
),
Collect(
packMatList,
{
item: Last(FirstN(Split(Result, "|"), 1)).Result,
quantity: Value(Last(FirstN(Split(Result, "|"), 2)).Result),
unitPrice: Value(Last(FirstN(Split(Result, "|"), 3)).Result),
discount:Value(Last(FirstN(Split(Result, "|"), 4)).Result),
total: Value(Last(Split(Result, "|")).Result)
}
)
)
When you concatenate column values from your collection into a string value, you should add a If function to detect if the Quantity is blank, if true, concatenate 0 into the string rather than Blank value. The Concatenate formula may look like below:
Concat(
CollectionTable,
item & "|" & If(IsBlank(quantity), 0, quantity) & "|" & unitPrice & "|" & discount & "|" & total & "$"
)
If you have solved your problem, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.
Best regards,
Thank you. I will be adopting the validation for the quality column into my solution.
User | Count |
---|---|
221 | |
98 | |
95 | |
55 | |
34 |
User | Count |
---|---|
273 | |
107 | |
105 | |
60 | |
60 |