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 Automate / Select action that onl...
Power Automate
Answered

Select action that only outputs columns in the source with values

(1) ShareShare
ReportReport
Posted on by 893 Super User 2026 Season 1
Hello,
 
I have a business user who created a multi question/condition MS Form, in which, depending on the answers, goes down different paths. Only certain fields are filled in each time.  When the form is submitted, I'd like to build a record of just the values that have been filled in. The empty columns can be ignored. Do I do this with a Select action and expressions? Or is there another way?
 
 
 
 
Thanks for any guidance!
Categories:
I have the same question (0)
  • Verified answer
    Sunil Kumar Pashikanti Profile Picture
    2,318 Moderator on at
     
    Select + expressions is the correct and supported pattern, but it must be combined with a filter step.
     
    Important limitation:
    The Select action by itself cannot conditionally remove properties. It always outputs all mapped keys, even when values are empty.

    Recommended Pattern
    1. Convert the form response into a key‑value object
    2. Convert that object into an array
    3. Filter out empty values
    4. Rebuild a clean object containing only populated fields (Optional)
    This pattern:
    Works reliably for branching MS Forms
    Scales well as questions change
    Avoids dozens of Conditions or hard‑coded branches
    Produces a clean, reusable output
     
    Step 1:
    Map each question name to its response:
    {
      "End Date": outputs('Get_response_details')?['body/EndDate'],
      "Seafood": outputs('Get_response_details')?['body/Seafood'],
      "Perishable or Total": outputs('Get_response_details')?['body/Perishable']
    }

    Sept 2:
    Convert object to array
         union(body('Compose'), body('Compose'))
     
    Step 3:
    Filter out empty values
         not(empty(item()?['Value']))
     
     
    ✅ If this answer helped resolve your issue, please mark it as Accepted so it can help others with the same problem.
    👍 Feel free to Like the post if you found it useful.
  • Cgangweg01 Profile Picture
    893 Super User 2026 Season 1 on at
    Thank you!
    So, step two basically creates a record in the array of each field in the response whether it has a value or not. Then filter the empty out.  Is that it?
  • Sunil Kumar Pashikanti Profile Picture
    2,318 Moderator on at
     
    Yes. Step 2 converts the response object into individual key‑value records (including empty ones). Step 3 filters out the empty values, leaving only the fields that were actually answered.
  • Chriddle Profile Picture
    8,708 Super User 2026 Season 1 on at
    The function union() cannot convert an object into an array.
     
    Try this instead:
     
    xpath(
    	xml(
    		addProperty(
    			json('{}'),
    			'Root',
    			outputs('Compose')
    		)
    	),
    	'/Root/*[. != ""]'
    )
    json(item())
  • Cgangweg01 Profile Picture
    893 Super User 2026 Season 1 on at
     
    Thanks for the solution for removing the empty property key/value pairs in my data set (the form response details). I got the same structured output that you did with my form test data now.
     
    However, I need these to be in a single object. Like this as it was.
     
    [
    {
     "End Date": "2026-04-17",
     "Perishable or Total": "Perishable"
    }
    ]
     
    I've tried an add property function in an apply to each with a variable as well as some other variations. Can't get anything to work even with some assist from Copilot.
     
    What do you suggest? Any xpath wizardry for this?
     
    Thanks again,
    Chris
  • Chriddle Profile Picture
    8,708 Super User 2026 Season 1 on at
    Easiest: Use function union()
     
     
    union(
    	coalesce(outputs('Compose')?[0], json('{}')),
    	coalesce(outputs('Compose')?[1], json('{}')),
    	coalesce(outputs('Compose')?[2], json('{}'))
    )
    Add an according parameter to the union function for each property of the original object (before filtering for empty properties).
     
  • Verified answer
    Chriddle Profile Picture
    8,708 Super User 2026 Season 1 on at
    If the above is not possible (e.g., because you don't know the maximum number of object properties) and you are not processing nested objects, you can also manipulate the JSON string.
     
    first(
    	json(
    		replace(	
    			string(outputs('Compose')),
    			'},{',
    			','
    		)
    	)
    )
    Same result as above.

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard