cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AShep
Level: Powered On

ForAll, Gallery and Filter

Hi,

 

I have a collection named WellDataCollection, which holds certain records.

There is another table named Runs which has some data which I need to extract using WellId which exist in WellDataCollection.

Since WellDataCollection.WellId did not work, I copied this collection into a gallery named WellDataCollectionGallery.

This is the piece of code that I wrote:

 

If (
!IsEmpty(WellDataCollection),
ForAll(
WellDataCollectionGallery.AllItems,
Notify(
GUID(WellDataCollectionGallery.Selected.WellID),
NotificationType.Information
);
Collect(
ExistingRunsCollection,
Filter(
'[dbo].[DHTRRunsDetails]',
WellId = GUID(WellDataCollectionGallery.Selected.WellID)
)
)
)
);

 

The problem is that even within the ForAll loop, WellDataCollectionGallery.Selected.WellID always returns with first item.

Unsure on how do I go to the next item in the list.

Also, is there any way in which I can do it without copying the collection in a gallery?

 

Any inputs will be greatly appreciated.

 

Thanks

--Ash

2 REPLIES 2
NMCLEOD
Level: Powered On

Re: ForAll, Gallery and Filter

Hi Ash, I'm assuming that the Notify syntax is not relevant?  Ultimately looks like your 'Collect' is not part of the 'ForAll' loop.  I'd suggest as a starter for 10, removing the Notify syntax (you can always add it back later), then get your Collect syntax into the body of the ForAll statement. Smiley Happy

emh
Level 8

Re: ForAll, Gallery and Filter

Hello,

 

If I understand correctly, here is what you are trying to perform.
If this were SQL:
SELECT WellData.WellID, Runs.*
FROM dbo.WellsData
INNER JOIN dbo.Runs
ON WellsData.WellID = Runs.WellID
In PowerApps this would be:
ShowColumns(
 AddColumns(
  WellData, "WellID",
  Lookup(Runs, WellID = WellsData[@WellsID], RunsData1)),
 "WellID", "RunsData1")
You can also join the entire Runs record instead of only choosing a single column from that table.
ClearCollect (WellAndRunsData,
 AddColumns(
  WellData, "WellID",
  Lookup(Runs, WellID = WellsData[@WellsID])))
 
Hope this helps.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 120 members 4,255 guests
Please welcome our newest community members: