Skip to main content
Community site session details

Community site session details

Session Id : EHXQkVSEqcRTp6JzmNn2gw
Power Apps - Building Power Apps
Unanswered

How to use collection to fetch record from table and store the result in another collection

Like (0) ShareShare
ReportReport
Posted on 4 Mar 2020 07:28:14 by 243

Hi,

 

I have 2 Tables 

I filtered data from one table based on Today's date and stored in a collection

I want to filter another table based on a field from my collection and need to store the result in another collection

 

  • WarrenBelz Profile Picture
    149,102 Most Valuable Professional on 05 Mar 2020 at 05:41:03
    Re: How to use collection to fetch record from table and store the result in another collection

    Hi @SumanKoduri ,

    That is SQL - not sure where that fits into Power Apps

  • SumanKoduri Profile Picture
    243 on 05 Mar 2020 at 05:30:42
    Re: How to use collection to fetch record from table and store the result in another collection

    this is my first collection record

     

    select * from returns_log where trunc(C5006_RETURN_LOGGED_DT) = to_date('04-03-2020', 'dd-mm-yyyy');

     

    RETURNS_LOG_IDSENDER_NAMEC5006_RETURN_LOGGED_DT
    123Jason04-MAR-20
    124Kumar04-MAR-20
    125Jack04-MAR-20

     

    From the above data i need to fetch data from another table using log id

    select * from returns_log_detail where returns_log_detail_id in (122,123,124,125);

     

    RETURNS_LOG_DETAIL_IDTAG_IDPART_NUMBER_ID
    12322226908.005
    12422227908.006
  • WarrenBelz Profile Picture
    149,102 Most Valuable Professional on 04 Mar 2020 at 11:05:55
    Re: How to use collection to fetch record from table and store the result in another collection

    Ok @SumanKoduri ,

    You are getting today's records with a collection as below

     

    ClearCollect(
     Collection1,
     Filter(
     '[5006RETURNS_LOG]',
     IsToday(C5006_RETURN_LOGGED_DT)
     )
    );

     

    and displaying this in a gallery I will call Gallery2 which then has to be selected to show the relevant record in a form and in this data set 5007logdetail  is an ID that you want to select to display the record on a form? If all of these assumptions are correct, the Item property of the Form would be something like

     

    Lookup(
     5007logdetail,
     ID = Gallery2.Selected.ID
    )

     

    Note I cannot see your data and need to rely on you for the correct field names and references.

     

    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.

     

  • SumanKoduri Profile Picture
    243 on 04 Mar 2020 at 10:33:20
    Re: How to use collection to fetch record from table and store the result in another collection
    ClearCollect(Collection1,Filter('[5006RETURNS_LOG]',IsToday(C5006_RETURN_LOGGED_DT)));
     
    From this collection I need to filter another 5007logdetail table, common field is id
    so based on the Id from collection1 I need to filter in 5007 table
  • WarrenBelz Profile Picture
    149,102 Most Valuable Professional on 04 Mar 2020 at 07:47:54
    Re: How to use collection to fetch record from table and store the result in another collection

    Thanks @SumanKoduri ,

    I was just giving you the filter code.

    I you give me the relevant field and data source names, as well as the collect code for you first collection, I will try to guide you.

    To collect the second one, from what I understand in your post

    ClearCollect(
     colSecond
     Filter(
     YourDataSetName,
     YourFieldName = Gallery1Name.Selected.YourFieldName
     )
    )

    I can do a more precise job when I know exactly what you want 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.

     

  • SumanKoduri Profile Picture
    243 on 04 Mar 2020 at 07:34:15
    Re: How to use collection to fetch record from table and store the result in another collection

    Thank you.

    I'm not using Gallery to filter record, I'm creating collection directly from table based on Today's date.

     

  • WarrenBelz Profile Picture
    149,102 Most Valuable Professional on 04 Mar 2020 at 07:32:02
    Re: How to use collection to fetch record from table and store the result in another collection

    Hi @SumanKoduri
    You do the same again - filter the second one

    Filter(
     YourDataSetName,
     YourFieldName = Gallery1Name.Selected.YourFieldName
    )

     

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete