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 / Extract only certain v...
Power Automate
Unanswered

Extract only certain values to csv, error records to another.

(0) ShareShare
ReportReport
Posted on by 6

I have this workflow

 

not uploading photo for some reason..

List Rows present in a table

parse json 

apply to each (body)

    Condition

yes

create a csv of accurate records

 

No

create a csv list of error records

 

THIS IS WHERE IM STUCK

 

initialize variable (Values)

select

create CSV table

 

(Very hard to read, sorry)

basically in the condition everything that is Yes, I want to continue and pass to the initialise  variable…. Everything that doesn’t pass, I want it to go to a csv that I can email the user.

 

How can I do this? The initialise variable doesn’t seem to pick up the list I have in the yes condition??

Categories:
I have the same question (0)
  • eliotcole Profile Picture
    4,390 Moderator on at

    Could you perhaps show us a screenshot of your flow, @WalnutMercury? 🙂

     

    EDIT - sorry, I just saw your note ... can you upload them to something like pixhost.to?

     

    Mostly because we will need to know:

    1. How you're working out what is inaccurate or not.
    2. Where the user records are coming from.
    3. Whether or not you should actually be collecting both the records that are accurate AND inaccurate.
    4. ... and more stuff I'm too dumb to think of! 😅

     

    If you can include some example data (fake it 'till you make it if it's sensitive) in a code box (click the </> in this editor) that would be even better!

     

    If you could copy any expressions that you use either into the comments of the actions or into a code box here, too ... HEAVENLY! 😅

  • eliotcole Profile Picture
    4,390 Moderator on at

    I am going to have a quick attempt, though, based on a gamble that your initial condition isn't required, and actually you should be capturing both sets of data anyway.

     

    If this is the case, lemme know and I'll try to give pictorial representation of this.

     

    Before I head down this road, if you can work out how to put your accurate / inaccurate calculations into a single ODATA filter on the incoming excel Get rows action, then you could do TWO excel Get rows one for each (and follow some of the logic below).

     

    At the start of your flow initialise two integer variables, and one boolean, I'll use example names, you name them whatever you like, just call them right later 😉:

    1. accurateCountVAR (integer)
    2. inaccurateCountVAR (integer)
    3. emailUserVAR (boolean)

    You won't be needing that Apply to each, here, either, as the Filter does that work.

     

    However you're working out what is accurate/inaccurate needs to be used to power two separate branches (not a condition) after the Parse JSON action. Now, in each branch, create a Filter actions after the Parse JSON to create the separate arrays of items.

    1. Accurate branch - Filter for accurate answers
    2. Inaccurate branch - Filter for inaccurate answers

     

    Filters are good for powering conditions, which we will now do. For each branch, and after each filter place a Set variable action, with accurateCountVAR in the accurate branch, and inaccurateCountVAR in the inaccurate one.

     

    Inside each variable you'll need an expression to count the items in the filtered data. So here use the length() function. Then click in the brackets (parentheses) of that length() and select the filter body of the filter above it in the branch.

     

    After setting the variable in each branch place a condition. I'll use the inaccurate branch for an example here:

    inaccurateCountVAR greater than 0

    In the Yes branch of this set the emailUserVAR to true, then create the CSV from the inaccurate filter above.

     

    Now you're nearly at the end of your flow, you just have two branches with nothing to bridge them at the end!

     

    Click the 'New step' button at the very bottom of the flow screen, and put one last condition in there. This time the condition is on:

    emailUserVAR equals true

    In the Yes branch here you can send your email, and leave the No branch blank. This way you can do whatever you like after the condition. 🙂

     

  • WalnutMercury Profile Picture
    6 on at

    This is exactly what I’m looking for 🙂 

    I would never have thought to do it using the filter condition so learnt a lot from reading your response!!

    if you could do a pictorial representation, that would be amazing!

    apologies for no photo etc, it won’t let me upload a picture from my phone unfortunately.

  • eliotcole Profile Picture
    4,390 Moderator on at

    OK, just remember this is super generalised, but hopefully you can take the logic and run with it.

     

    Here I've filtered for errors in the email column, if they included the @ symbol it's fine (it might not be, but we're keeping it quick), if they didn't it's inaccurate.

     

    logic for filtering errors.jpg

     

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 Automate

#1
Haque Profile Picture

Haque 608

#2
Valantis Profile Picture

Valantis 416

#3
11manish Profile Picture

11manish 348

Last 30 days Overall leaderboard