Hi,
I have a toggle control in my master form to show if all items have been delivered; i want to toggle this to 'True' (else false) if all items in a SharePoint list have their value set to 'Yes' in the Delivered? column i.e. if only one item is set to 'No' then the Toggle value will remain 'False' in the form. The common value for each item is PONumber.
Any help much appreciated,
kind regards,
Mike
Solved! Go to Solution.
So you probably need to look at your filters a bit more and wrap your head around what is going on.
It seems that you have a PO Items List, which is a filtered list of items that match the PO number you have in the master form (the top part of your screen).
I don't know if POOrderDetails is a filtered collection or if it is a datasource of your Add/Edit PO Items list.
So, one of the things you can use to shortcut all the filters is to use the data of the gallery as it is shown. I personally do this often when filtering - filter once and then derive everywhere from that. The reason I mention it is for my next suggestion, which is to change your toggle default logic to this:
CountRows(Filter(POItemGalleryName.AllItems, ItemDelivered<>true))=0
Notice in this case (not sure what your Gallery name is, but substitute it in there) that we're cunting the rows where the value is false ("No"). If it is 0 then we can say they are all true and our toggle should go to true.
Try this for your Default property:
CountRows(Filter(SPList, Delivered<>false))>0
BTW: There is a glitch/bug with filters on "Yes/No" SharePoint columns. I have found the workaround to be to use the <> operator rather than the = will be something to keep in mind. So, re-reading the filter above, I am filtering on "Delivered=true". However, using that exact wording will yield improper results. So, looking for the inverse of it will work "<> false" means "= true".
Hi Randy,
Thanks for your response although i tried it and the toggel value is not changing as expected. I think the problem is that i could have mutliple values with the same PO Order number. I guess the forumla you have posted should bring back a true value even if just one of these values is set to true, however, it still does not seem to work.
What i want is for the toggle value to only show true if all items have delivered set to true (or yes) . Hope attached screenshot better explains what i'm trying to achieve. The two rows in the gallery show two items from the POOrderDetails list and the Item Delivered toggle in the Form updates the POLog form.
Any further help much appreciated.
thanks,
Mike
So you probably need to look at your filters a bit more and wrap your head around what is going on.
It seems that you have a PO Items List, which is a filtered list of items that match the PO number you have in the master form (the top part of your screen).
I don't know if POOrderDetails is a filtered collection or if it is a datasource of your Add/Edit PO Items list.
So, one of the things you can use to shortcut all the filters is to use the data of the gallery as it is shown. I personally do this often when filtering - filter once and then derive everywhere from that. The reason I mention it is for my next suggestion, which is to change your toggle default logic to this:
CountRows(Filter(POItemGalleryName.AllItems, ItemDelivered<>true))=0
Notice in this case (not sure what your Gallery name is, but substitute it in there) that we're cunting the rows where the value is false ("No"). If it is 0 then we can say they are all true and our toggle should go to true.
Thanks Randy!
I tweaked your formula and it worked:
If(CountRows(Filter(POOrderDetails,PONumber=Gallery1.Selected.PONumber, ItemDelivered=false))=0,"Yes","No")
I replaced the toggle datacard with a text input one as i only needed Yes/No to be in View mode. The gallery was showing submitted values in the POOrderDetails list so pointed to that instead.
Thanks again - much appreciated
Mike
Facing a similar issue here but with "super-nested JSON" response from a Custom Connector. Any insights are appreciated!
Scenario:
First( First( colCustomConnectorResponse.level1 ).level1.level2 ).level2
If( ThisItem.level3.level4 = "Y", true, false )
If( First(
First(
First(
colCustomConnectorResponse.level1
).level1.level2
).level2.level3
).level3.level4= "Y", true, false )
Visual aid:
Thoughts?
That's a lot of levels!!
You might want to consider putting some "AddColumns" to your Items in the Gallery that will contain the status value (and the nasty formula needed to get to it). That way you'll have an easier view of it as your create other formulas. If you make the Added Column a numeric condition (0 = "off", 1 = "on"), then perhaps you could use a formula on your Big Toggle like this:
Sum(Gallery1.AllItems, myAddedColumn) = CountRows(Gallery1.AllItems)
That way if all toggles are on in the gallery the sum will equal the count and thus your BIG toggle should be "On".
Hope that helps some.
Hi @RandyHayes , thanks for the insights. I'm trying to get this going, not used AddColumns before.
Here's where I'm at:
AddColumns(colCustomConnectorResponse, "myNewColumn",
If(
First(
First(
First(
colCustomConnectorResponse.level1
).level1.level2,
).level3.level4 = "Y",
1,0
)
)
The formula is not flagged by intellisense, appears to be "working", but I don't see "myNewColumn" in anywhere in the collection.
Wonder if I need to add all those "First()'s" to the AddColumn(source, ?
AddColumns, RemoveColumns, and ShowColumns are all "chain" formulas. In other words, they *return* the results of the actions that they take, they don't alter the paramters given.
So, in this case, the AddColumns is working, but it is going nowhere.
Typically I would user Add/Remove/Show at the point that I gather the information and assign it to a collection if needed, but in this case the only thing you're going to need is to put this result in a collection.
So - wrap this formula you have with a ClearCollect(colCustomConectorResponse, AddColumns....<the rest of your formula>...)
This will put the results of the AddColumns into the collection.
Also, since you are actually doing this "Post Collection", you might want to designate another collection name as PowerApps might get a little freaky about the change of structure.
Again, it is better if you can, to use the AddColumns at the point in which you initially create your colCustomConnectorResponse collection.
Hope that makes sense.
Hm. Interesting.
More experimentation to come!
FUN!
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
202 | |
176 | |
62 | |
32 | |
30 |
User | Count |
---|---|
324 | |
268 | |
104 | |
74 | |
56 |