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 Platform Community / Forums / Power Apps / Using LookUp on a Coll...
Power Apps
Suggested Answer

Using LookUp on a Collection blanks out data in fields

(1) ShareShare
ReportReport
Posted on by 4
1. Add Environment Variable data sources.
 
2. Wrote code to extract some fields from the Environment Variables:
 
and confirmed Collection has data:
 
3. Tried to use LookUp to retrieve the value for "bt_DebugMode"
 
 
and the Collection is now missing data for the EnvValue and EnvVariableName columns:
 
Why is that?
 
I can use LookUp ok with Collection that got data from a JSON payload, etc, but somehow Environment Variables are behaving differently.
 
Categories:
I have the same question (0)
  • Suggested answer
    MS.Ragavendar Profile Picture
    6,334 Super User 2026 Season 1 on at
     
    // Build the collection
    ClearCollect(
        colTest,
        AddColumns(
            'Environment Variable Values',
            "EnvSchemaName",    'Environment Variable Definition'.'Schema Name',
            "EnvVariableName",  'Environment Variable Definition'.'Display Name',
            "EnvValue",         Text(Value)
        )
    );
     
    // Read just the value you need
    Set(
        gblDebugMode,
        LookUp(colTest, EnvSchemaName = "bt_DebugMode", EnvValue)
    );
     
    ✅If this helped, please Accept as Solution to help others ❤️ A Like is appreciated 🏷️ Tag @MS.Ragavendar for follow-ups.
  • Keng.Ng-AUS Profile Picture
    4 on at
    Thanks, Ragavendar. I tried your suggestion:
     
        //Get Environment Variables
        ClearCollect(colTest,
            ForAll('Environment Variable Values', {
                'EnvSchemaName': 'Environment Variable Definition'.'Schema Name',
                'EnvVariableName': 'Environment Variable Definition'.'Display Name',
                'EnvValue': Text('Value')
            })
        );
     
        Set(vEnvTest, LookUp(colTest, EnvSchemaName="bt_DebugMode",EnvValue));
     
    It didn't work. vEntTest has not value:
     
    And the data for two columns in the Collection colTest was erased:
    Very confusing.
     
  • Suggested answer
    Kalathiya Profile Picture
    1,690 Super User 2026 Season 1 on at
    Hello @Keng.Ng-AUS
     
    Try using EnvValue: 'Value' without wrapping it in Text(). Sometimes the environment variable is a complex type and wrapping it in Text() won’t work. Try it without Text() should work as expected.
     
    Try this formula:
    ClearCollect(
        colTest,
        ForAll(
            'Environment Variable Values',
            {
                EnvSchemaName: 'Environment Variable Definition'.'Schema Name',
                EnvVariableName: 'Environment Variable Definition'.'Display Name',
                EnvValue: 'Value'
            }
        )
    );
     
    LookUp Filter specific value: 
    LookUp(colTest, EnvSchemaName="cr1bf_Test",EnvValue)
    If this response resolves your issue, please mark it as the Verified Answer so it can help other community members as well.
    ---------------------------------------------------------------------------------

    📩 Need more help? Just mention @Kalathiya and I’ll be happy to assist.

    ✔️ If this answer helped you, please tick “Does this answer your question?” so it can be marked as the Verified Answer.

    💛 A Like always motivates me to keep contributing!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard