cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Update Y/N Column based on multiple choice field

I am trying to build a flow to pick up items from a multiple choice field and match them with a Y/N column. I have 48 Y/N columns, 1 Y/N column that indicates attendance, and a multiple choice column that has all of the names of the 48 Y/N columns. 

 

What we need: After the multiple choice column has been filled out, if the attendance column is marked with a 'Yes', a flow would be triggered and match the multiple choices to the 48 Y/N columns and mark the matched ones with a "Yes".

 

Sounds complicated, but if at all possible, it would make our lives so much easier. 

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

The infinite trigger error might be due to using When an Item is Created or Modified. In my example I used "When an Item is Created" so there is no way there could be an infinite loop.

 

I'm not understanding the second error due to what you have changed. You will have to explain that more.

 

Are you saying that have changed the Power App to no longer fill in a Multi-Choice column, but instead it will put a Yes into each the individual columns? And now you want to read all of the Yes columns and update the item multi-select choice column with the choices that have a corresponding Yes column?

View solution in original post

16 REPLIES 16

Can you provide a screenshot of the multiple choice column and some of the Y/N columns?

I'm having a hard time understanding what is happening. Would like to see what this multiple choice column option look like. 

 

Is this all happening in the same SharePoint list? Or is it being imported from a MS Form or something else?

Yes, of course. See screenshot. Annotation 2023-07-06 165804.png

This list tracks training attendance per associate/per date (whether they attended or not). However, if they do attend, they are  marked with a Yes and based on the multiple choice column (Training Type) selection, we would then mark with a "Yes" under the column that matches each name on the multiple choice field. (I am so sorry for the lengthy explanation).

 

The reason we decided to have both, the multiple choice column in addition to the Y/N columns is because we also need to track whether the associate did not attend a specific training session so they can get rescheduled in the future. Additionally, we need to pull reports based on positive attendance per each specific Y/N column. 

 

The first 7 columns of the list are being extracted via powerautomate through file upload in powerapps.

Yes, of course. See screenshot. 

 

This list tracks training attendance per associate/per date (whether they attended or not). However, if they do attend, they are  marked with a Yes and based on the multiple choice column (Training Type) selection, we would then mark with a "Yes" under the column that matches each name on the multiple choice field. (I am so sorry for the lengthy explanation).

 

The reason we decided to have both, the multiple choice column in addition to the Y/N columns is because we also need to track whether the associate did not attend a specific training session so they can get rescheduled in the future. Additionally, we need to pull reports based on positive attendance per each specific Y/N column. 

AMR1009_0-1688679334777.png

The first 7 columns of the list are being extracted via powerautomate through file upload in powerapps

Hhhmmmm very interesting. Don't apologize for lengthy explanation, it helps.

 

I think it can be done, but it would require that the column name matches the value. Also that the column with the options is a choice field (it looks like it is).

 

I'm testing something right now for it. I'm assuming the trigger will be "When an Item is Created" so basically the item is created in the list with the first 7 columns filled, and then power automate will get the item and do the hard work on the choice column to update the other columns. 

 

Before I start trying to get this configured. Why can't this be done when the item is initially created from the power app? I'm not familiar with the file upload in power apps. Are they dropping a document in power apps and it is filling in all of this information automatically? Or does the user make any selections in power apps?

You don't have to explain too much about the power app. I'm basically saying that if a person is making these selections in power apps than it should be easy to get the info into sharepoint list.

Yep. The column with the options is a multiple choice column that contains the same names of the rest of the y/n columns. This is what the file looks like since that is really all we need from a training standpoint (associate name, and if they attended + any additional notes that might need to be shared).

 Annotation 2023-07-06 183741.png

The person leading the training session would fill that out and drop it on the app screen where they would select the session date, the associate's location, and what type of training (this dropdown populates the same choices from the choices column in the SP list).

AMR1009_0-1688683494829.png

 

--I am currently working on making all of the values in the choice column be identical to the other column names.

 

forgot to mention -- once the user hits 'submit' a flow is triggered to extract the info from the file + transfer it to SP. it also looks up additional information from other sources to fill out the remainder of the first 7 fields. 

Thank you for the information, it is helpful. I am not going to be able to work on this today, but I can on Monday. 

If you want to try to test some things, I'll let you know what I planned on trying.

 

https://www.tachytelic.net/2020/10/remove-unwanted-characters-power-automate-flow/

 

The link above shows instructions for how to increment through letters of a text string and remove the unwanted/invalid characters. The Invalid Characters are pre-typed in an array.

 

This isn't exactly what I was going to do, but the concept was similar. Trying to put the column names in an Array and then the Multiple Choice responses in another Array, then compare the two. Finally trying to get that into a format that can be easily used for an update item.

 

I think using HTTP requests might be helpful since you could pull the field to get all of the multiple choice options, put them in an Array. (This would prevent needing to hard type names into the flow every time the column is updated.)

 

Maybe use another HTTP request to update the item. This could be a loop where the column name and choice are a variable. So it would basically update the item 48 times for each column individually. 

The alternative will be a basic Update Item action and then have to put some kind of if() expression that will check whatever compare array.

 

Lastly I think there needs to be an additional column that is almost for errors or no matched items. So if something is put into the multiple choice column that shouldn't be there (due to how the PowerApp upload works) it would list those specific options. Like hey here are some options that are in the multiple choice column but didn't actually update a real column. 

I don't know if that is necessary, but kind of a contingency since there seems to be possibility of a variability of inputs.

 

So not exactly sure how this will look, but thats my general idea.

Do you still need a solution for this? I have a working flow, but it's been a week since the last message, so I don't want to write up all the instructions if you already have this solved some other way.

Hi there! Yes, I still need a solution as I haven't been able to successfully build a flow that does what I need. I appreciate you following up!

Ok I have the flow made with picture instructions. The primary key to make the flow work starts with you to manually input the column names (Title and InternalName) as well as the corresponding multi-choice response into an Array variable. This variable will be used to reference what was selected in the multi-choice response to the corresponding column.

 

The benefit of this manual array is that you can easily match choice values to the columns and don't need to choice options to exactly match the column name. 

The difficult part of this manual array is making sure the text match exactly as well as the format of the array itself. If you are off by a space or incorrect letter, then it will not work correctly.

 

FYI: I made the flow and manual array in this format so that it is possible to adjust the flow and add some steps so that the column names and choice values can be pulled using an HTTP request without needing to type the full manual array. However, I think the example is better with the manual array since it is easier to adjust for text errors.

 

Below is my example SharePoint List and Columns:

SharePoint List ViewSharePoint List ViewSharePoint Multi-Choice ColumnSharePoint Multi-Choice ColumnSharePoint List SettingsSharePoint List Settings

 

Below I am showing the individual Boolean (Yes No) type column names. This is to give an idea of how the column Title (what is displayed) can be different than the column InternalName that is used by power automate.

Column - AmazonColumn - AmazonColumn - Crate & BarrelColumn - Crate & BarrelColumn - NissanColumn - NissanColumn - Amazon - SecureColumn - Amazon - SecureColumn - DSGColumn - DSGColumn - Marvel StudiosColumn - Marvel Studios

 

SharePoint columns have a Title and InternalName. The Title is what is displayed and can be changed. The column InternalName will never change after creation, even if the Title is changed, and the InternalName will encode special characters. 

 

Below I am making a table to show how my SharePoint List Boolean (Yes No) columns correspond with the Multi-Choice options.

 

Column TitleColumn InternalNameCorresponding Multi-Choice Option
AmazonAmazonAmazon
Crate & BarrelCrateBarrelCrate & Barrel
NissanNissanNISSAN
Amazon - SecureAmazon_x0020__x002d__x0020_SecurAmazon Secure
**bleep**'s Sporting GoodsDick_x0027_s_x0020_Sporting_x002DSG
Marvel StudiosMarvel_x0020_StudiosMarvel

 

This same type of relationship will be typed into the Manual Array in the flow.

 

Below is an outline of the flow actions:

Example Flow OverviewExample Flow Overview

I have renamed actions using custom titles, but the type of action such as "Parse JSON", "Select", "Set Variable", "Update Item", etc, is within the first part of the name so you should be able to tell what type of action to add to your flow. For example, the action "A2 Parse JSON - ManualColumnReferenceArray" is a Parse JSON action that I renamed. Similarly, the action "B1 Select - MultiChoice Response Format" is a Select action that I renamed.

 

I will begin to show detailed parts of the flow with descriptions.

Flow Detail 1Flow Detail 1

The beginning of the flow is basically a trigger for when an item is created and then to Initialize Variable of an Array. This Array will be manually filled in a following step with the column names and corresponding choices. So leave it blank when it is initialized.

 

The manual array needs to be filled in the step "A1 Set Variable - Manual Column Reference" in the correct format. You need to insure the text matches column names and choices as well as no additional spaces added.

 

Flow Detail 2 - Manual Array ReferenceFlow Detail 2 - Manual Array Reference

 

Below is the text format of what to use in the "A1 Set Variable - Manual Column Reference" so you can copy and paste into your flow and edit the column names. If you need more columns, just add to the example but remember to not have a comma after the last item.

[
  {
    "InternalName": "Amazon",
    "Title": "Amazon",
    "ChoiceOption": "Amazon"
  },
  {
    "InternalName": "CrateBarrel",
    "Title": "Crate & Barrel",
    "ChoiceOption": "Crate & Barrel"
  },
  {
    "InternalName": "Nissan",
    "Title": "Nissan",
    "ChoiceOption": "NISSAN"
  },
  {
    "InternalName": "Amazon_x0020__x002d__x0020_Secur",
    "Title": "Amazon - Secure",
    "ChoiceOption": "Amazon Secure"
  },
  {
    "InternalName": "Dick_x0027_s_x0020_Sporting_x002",
    "Title": "**bleep**'s Sporting Goods",
    "ChoiceOption": "DSG"
  },
  {
    "InternalName": "Marvel_x0020_Studios",
    "Title": "Marvel Studios",
    "ChoiceOption": "Marvel"
  }
]

 

The action "A2 Parse JSON - ManualColumnReferenceArray" is a Parse JSON on the array variable. The schema should not change since the values being used are the same no matter how many columns you add to the array.

 

Use the text below to copy and paste directly into the Parse JSON schema. 

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "InternalName": {
                "type": "string"
            },
            "Title": {
                "type": "string"
            },
            "ChoiceOption": {
                "type": "string"
            }
        }
    }
}

 

The next flow steps are to initialize two more variables that will be used later and map the outputs of the SharePoint List Item choice columns using a Select action.

Flow Detail 4 - Select Choice ValuesFlow Detail 4 - Select Choice Values

 

Within the Select action the From: is the full choice column body and the Map is the choice column Value. There will be multiple dynamic content options for a choice column, so be sure to put the Body in the From and the Value in the Map. 

 

The next flow step is an Apply to Each which is using the array variable that has the column names. The apply to each is going through each column name and corresponding choiceOption and comparing it to what is mapped in the Select action. 

So for each column name, it is asking, "Does the Select output contain the ChoiceOption for this column? If yes, then put a value of true, if no, put a value of false."

Flow Detail 4 - Apply to Each ColumnFlow Detail 4 - Apply to Each Column

 

The format and expression used in "C1 Append to Array Variable - BooleanColumnResultsArray" is so that it can add each value to an array. The format is below:

{
  {InternalName}: {true/false}
}

 The if() expression used to determine if the value should be true or false is below:

if(contains(body('B1_Select'),items('C0_Apply_to_Each')?['ChoiceOption']),true,false)

The exact example used with my action names is below:

{
  items('C0_Apply_to_Each')?['InternalName']: if(contains(body('B1_Select_-_MultiChoice_Response_Format'),items('C0_Apply_to_Each')?['ChoiceOption']),true,false)
}

 

The action "D1 Set Variable - ResultsObject" is taking the variable array "BooleanColumnResultsArray" and formatting it into a single object. It is doing this by converting it to a string, replacing the array brackets, and then setting it to a json object.

This is so that the Update Item can be used without an Apply to Each which would be required if using an Array variable. Since it will be a single object, you can call individual items out of the ResultsObject in the Update Item step.

The expression used in "D1 Set Variable - ResultsObject" is below:

json(replace(replace(replace(string(variables('BooleanColumnResultsArray')), '[{', '{'), '}]', '}'), '},{', ','))

 

The Update Item is relatively simple for calling values out of the variable ResultsObject.

Flow Detail 5 - Update ItemFlow Detail 5 - Update Item

 

The only difficult part of the Update Item action is needing to manually type in the expression that will reference the value from the ResultsObject variable.

 

Below are the specific steps for putting the expression to get the value out of the variable. It is basically variable('ResultsObject')?['InternalName'] for each column.

The InternalName is what was used in the ManualColumnReferenceArray;

 

Update Expression 1Update Expression 1Update Expression 2Update Expression 2Update Expression 3Update Expression 3Update Expression 4Update Expression 4

 

I made an item in my SharePoint list that had all choice options selected and here are the results:

Flow Results 1Flow Results 1Flow Results 2Flow Results 2Flow Results 3Flow Results 3SharePoint List ResultsSharePoint List Results

 

This might seem like a lot, but the flow is actually short. You just have to make sure the items are referenced correctly. I wanted to add a lot of pictures to help reference. 

 

Let me know if this works for you,

Hi there! I had to put a pin on this project to shift my focus towards a different one. I was able to replicate the flow but I'm getting 2 different errors - one says "Actions in this flow may result in an infinite trigger loop" and the second one says that the 'from' field in the select multichoice format is 'null'... but i am now realizing that because i had to tweak it to work in the inverse, i might have broken it lol. I made the flow for a second app that works in a similar manner but it needs to pick up the 'yes' from the text columns (y/n columns are a pain), and select the corresponding choice in the choice column. 

The infinite trigger error might be due to using When an Item is Created or Modified. In my example I used "When an Item is Created" so there is no way there could be an infinite loop.

 

I'm not understanding the second error due to what you have changed. You will have to explain that more.

 

Are you saying that have changed the Power App to no longer fill in a Multi-Choice column, but instead it will put a Yes into each the individual columns? And now you want to read all of the Yes columns and update the item multi-select choice column with the choices that have a corresponding Yes column?

Hello,

 

If I understand everything correct this can be done with 2 or 3 simple steps and I will provide a quick solution for it but first of all we should be careful about the infinity loop. If the trigger watches for updates, this could be a problem because if you update the list when using flow, this will also be recognized as update and trigger the flow again ending in an infinity loop.

 

So how does it work right now? The user creates the item and updates it later. Or will the item be updated all the time? Is it possible, that the user also updates the items by removing one of the choices and the flow should also switch a yes back to no? This all is important to know.

This is how I would do it.

 

Matthy79_0-1691742925626.png

 

But as I said. Depending on the requirement you may have to add an additional step to "translate" the multichoices to the yes/no names and maybe check if the last update was from flow and of course if it is possible to remove a multichoice value later this also has to be modified.

At the moment, it is set up for manual updates. So, once my team receives notification that an upload has been completed, we go in and see who is marked with positive attendance and what was taught in the training session. Based on that, we put a checkmark under the corresponding column. Sounds simple, but when you're supporting 500+ associates, it can get messy and chaotic. lol

I created an additional test list to see which way would be the most effective to see the data in both formats, y/n columns as well as combined into one string. 

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (803)