web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Suggested Answer

Use Record vs Text

(1) ShareShare
ReportReport
Posted on by 26
Hello!
 
In my PowerApp, I have currently two different data sources:
1. Sharepoint list
2. Excel table file
 
From the sharepoint list, I have a gallery displaying "Title", example "992" , "993", "994" and so on
Now, on the OnSelect of that Gallery I have the following:
 
 
UpdateContext({SNKitView: ThisItem });
Set(SNKitViewRecord, SNKitView);
 
 This has worked well in the app, so if possible I'd like to keep this the same.
 
The problem I am having is when I add the second data source, the Excel file:
 
Now, I have a button called "CurrentSN" which extracts a single SN from the excel file (different SN from the gallery) on its Text property.
The ideal would be to on the button's OnSelect, have it read the Text property and update the SNKitViewRecord so instead of the record being the one i selected from the gallery, now it would be the one I clicked on the button.
 
I tried something like this on the OnSelect of the button:
 
UpdateContext({SNKitView: Self.Text});
Set(SNKitViewRecord, SNKitView);
 
Of course it didnt work, since I can't mix record and texts together.
 
I also tried this:
 
UpdateContext({SNKitView: {Title: Self.Text} });
Set(SNKitViewRecord, SNKitView);
 
Any tips on how to update the SN when clicking the button by keeping using the same record from the gallery?
 
Categories:
  • Suggested answer
    Pstork1 Profile Picture
    69,661 Most Valuable Professional on at
    Try using the SetProperty() function to update the Title property of the Context variable.  Like this.
     
    SetProperty(SNKitViewRecord.Title, Self.Text);
     
    The SNKitViewRecord is a record with multiple properties so you can't update it with a simple value for one of the properties.  But if its already been created as a record then you can update a single property of the record with a value.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
     
  • Suggested answer
    WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at
    Assuming you want to keep your current structure (not sure why you want to Context Variable,) then you would do this
    UpdateContext(
       {
          SNKitView: 
          LookUp(
             SPListName,
             Title = Self.Text
          )
       }
    );
    Set(
       SNKitViewRecord,
       SNKitView
    );
    but you really only need this
    Set(
       SNKitViewRecord,
       LookUp(
          SPListName,
          Title = Self.Text
       )
    );
     
    Please Does this answer your question 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 answering Yes to Was this reply helpful? or give it a Like
    Visit my blog
    Practical Power Apps    LinkedIn  
  • Suggested answer
    Mohsin Ali Profile Picture
    849 on at
    Hello @VO-16022037-0 -  Since SNKitViewRecord is holding the complete SharePoint record, I wouldn't replace it with Self.Text, as that is only a text value.
     
    Instead, use the SN coming from Excel to find the corresponding record in your SharePoint list:
     
    Set(
        SNKitViewRecord,
        LookUp(
            YourSharePointList,
            Title = Self.Text
        )
    )
    This way, whether the user selects an item from the gallery or clicks the button, SNKitViewRecord will continue to contain a SharePoint record rather than sometimes being a record and sometimes being text.
     
    You could also simplify your Gallery OnSelect to:
    Set(SNKitViewRecord, ThisItem)
    So both approaches ultimately populate the same variable with the same record type.
     
  • Suggested answer
    11manish Profile Picture
    4,617 Super User 2026 Season 2 on at
    Keep your existing Gallery/ThisItem logic. For the Excel button, use LookUp() to convert the Excel SN into the corresponding real SharePoint record. This gives you a consistent SNKitViewRecord regardless of whether the user selected the record from the Gallery or from the Excel-driven button.
  • Suggested answer
    Valantis Profile Picture
    7,371 Super User 2026 Season 2 on at
     
    Worth flagging on one of the suggestions above, SetProperty only works on actual control properties inside Test Studio, it's not meant for mutating a field on a variable in a running app, so that formula won't do what's described here.
     
    The LookUp approach in the other replies is the right pattern. Since SNKitViewRecord needs to end up as an actual SharePoint record either way, not text, LookUp against Title = Self.Text gets you that consistently no matter which control triggered it.
     
      Best regards,

    Valantis   ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/ 💼 LinkedIn   ▶️ YouTube
  • Suggested answer
    BilalDev_01 Profile Picture
    86 on at

    You’re correct that Self.Text is text, while ThisItem is a record. Rather than replacing the record with text, use the text value to find the corresponding SharePoint record.

    For example, if CurrentSN.Text contains the SN and the SharePoint Title column contains that SN:

    Set(
        SNKitViewRecord,
        LookUp(
            'Your SharePoint List',
            Title = Self.Text
        )
    )
    

    Then SNKitViewRecord will still be a SharePoint record, so the rest of your app can continue using it exactly as before.

    You can also keep your existing gallery logic:

    UpdateContext({SNKitView: ThisItem});
    Set(SNKitViewRecord, SNKitView);
    

    And on the Excel button:

    Set(
        SNKitViewRecord,
        LookUp(
            'Your SharePoint List',
            Title = Self.Text
        )
    )
    

    If the Excel SN and SharePoint Title don't match exactly, adjust the LookUp condition accordingly.

    The {Title: Self.Text} approach creates a record with only a Title field, but it isn't the same schema as your SharePoint record, which is why it can cause problems later when you reference other fields.

  • Suggested answer
    Henil Profile Picture
    14 on at

    Hi @VO-16022037-0,

    The issue is that SNKitView starts out as a record (from ThisItem), but then you're trying to set it to plain text (Self.Text). Power Apps wants a variable to keep the same shape every time you set it, so switching between a record and a text value causes it to break. That's also why {Title: Self.Text} didn't work - that only has one column, so it doesn't match the shape of the record coming from your Gallery.

    If the SN on your button matches an item that's also in the same SharePoint list, you can fix this with a LookUp() instead of typing out a record by hand:

    UpdateContext(
        {
            SNKitView:
                LookUp(
                    YourSharePointList,
                    Title = Self.Text
                )
        }
    );
    Set(SNKitViewRecord, SNKitView);

    Please add your actual sharepoint list name instead of "YourSharePointList".

    This grabs the record from your SharePoint list where Title matches the SN on the button, so SNKitView stays a full record no matter where it comes from - the Gallery or the button.

    You mentioned the button's SN actually comes from the Excel file, though, not SharePoint. If that SN only exists in Excel and not in your SharePoint list, the formula above won't find a match. In that case, just point the LookUp() at your Excel table instead:

    UpdateContext(
        {
            SNKitView:
                LookUp(
                    YourExcelTable,
                    SN = Self.Text
                )
        }
    );
    Set(SNKitViewRecord, SNKitView);
     
    Swap in your actual Excel table name and the column that holds the SN value. Just keep in mind this only works if SNKitViewRecord is always going to hold an Excel record from here on. If you need it to sometimes hold a SharePoint record and sometimes an Excel record, it's best to use two separate variables (one per source) rather than one variable trying to do both, since Power Apps expects a variable's shape to stay consistent.
     

    🏷️ Tag me if you're still stuck or have more questions.
    ✅ If this solves your issue, please Accept as Solution so it can also help others facing the same problem.
    ❤️ If you found this helpful, a Like is always appreciated!
    💼 Happy to connect on LinkedIn: https://www.linkedin.com/in/henil-patel25/

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard