Hey there, I got a string delimited SP column date value. (See attached pic) In PowerApps, I am trying to load this value and split it into row values.
For example lets say in the date col of my list I have this value - 9/08/2022;10/08/2022;11/08/2022.
I want to create a collection in Powerapps and display the above column value in different rows :
Date
-----
row 1 - 9/08/2022
row 2 - 10/08/2022
row 3 - 11/08/2022
Whats the best way I can go about doing this? I tried using Split function but its not working as its a table record and not String.
Thanks in advance
Solved! Go to Solution.
@Anonymous
Great question!
I have a solution for that below.
I believe this solution is also much improved from the solution I gave first, there is not even an Intermediate_collection anymore, you can check it:
Test sample collections
Date | Employee |
9/08/2022;10/08/2022;11/08/2022 | John;Mark;Troy |
12/08/2022;01/08/2023 | Mike;Jack |
(by the way, I made this solution to support not only semicolon delimited Date and the second column of semicolon delimited Employee, but also, more than one row as well, in case you need that too)
Results in a test Gallery:
Formula:
The main formula, OnVisible of Screen1, is:
NOTE: This formula does not validate if the number of semicolon-delimited elements in both columns are the same, and this can cause unexpected results. Read on further for a version of this formula that does validate if the number of elements are the same!
Clear(Destination_collection);
ClearCollect(Source_collection,{Date:"9/08/2022;10/08/2022;11/08/2022 ",Employee:"John;Mark;Troy"},{Date:"12/08/2022;01/08/2023",Employee:"Mike;Jack"});
Clear(Outer_Temp_count);
Clear(Temp_count);
ForAll
(
///////
ForAll
(
Source_collection As SourceData
,With
(
{
IndividualDates:Split(SourceData.Date,";")
,IndividualEmployees:Split(SourceData.Employee,";")
}
,Collect(Outer_Temp_count,CountRows(Temp_count));ForAll
(
IndividualDates As IndividualDate
,Collect(Temp_count,0);
{
Date :IndividualDate.Result
,Employee:Last(FirstN(IndividualEmployees,CountRows(Temp_count)-Last(Outer_Temp_count).Value)).Result
//,Counts:CountRows(Temp_count)-Last(Outer_Temp_count).Value
}
)
)
) As Intermediate
,Collect(Destination_collection,Intermediate.Value)
///////
);
NOTE: The solution may give unexpected results if the number of delimited elements in Date differs from the number of delimited elements for Employee. For now, the presumption is both should be the same.
Formula that validates the number of semicolon-delimited elements:
Here below is another version of the formula, where it just skips the whole row and shows a red notification error on the screen, if the lengths of the semicolon separated elements of Date and Employee end up not matching on that row.
This is the version of the formula that is actually inside of the attached sample app:
//this version checks to see if the number of elements in each column are the same, and if not, it skips the row and shows an error notification!
Clear(Destination_collection);
ClearCollect(Source_collection,{Date:"9/08/2022;10/08/2022;11/08/2022",Employee:"John;Mark;Troy"},{Date:"12/08/2022;01/08/2023",Employee:"Mike;Jack"});
Clear(Outer_Temp_count);
Clear(Temp_count);
ForAll
(
///////
ForAll
(
Source_collection As SourceData
,With
(
{
IndividualDates:Split(SourceData.Date,";")
,IndividualEmployees:Split(SourceData.Employee,";")
}
,With
(
{RowCounts:Distinct([CountRows(IndividualDates),CountRows(IndividualEmployees)],ThisRecord).Result}
,
If
(
CountRows(RowCounts) > 1
,Notify("The number of delimited elements must match in all columns",Error);Blank()
,Collect(Outer_Temp_count,CountRows(Temp_count));ForAll
(
IndividualDates As IndividualDate
,Collect(Temp_count,0);
{
Date
:IndividualDate.Result
,Employee
:Last(FirstN(IndividualEmployees,CountRows(Temp_count)-Last(Outer_Temp_count).Value)).Result
//,Counts:CountRows(Temp_count)-Last(Outer_Temp_count).Value
}
)
)
)
)
) As Intermediate
,Collect(Destination_collection,Intermediate.Value)
///////
);
Working Sample msapp
I have attached a working sample msapp file app34b.msapp if you would like to import a full, working example yourself for your convenience.
To use the sample msapp attached, follow these steps:
1) Download the msapp file attached to this post (it's at the bottom of this post), to Desktop or a folder of your choice, by clicking on it from this post.
2) Create a new, blank Power App Canvas App
3) Go to File -> Open -> Browse
4 ) Navigate to location of .msapp file from Step 1, select it, and press the "Open" button.
5 ) The working example msapp file should load
6 ) Toggle between Screen2 and Screen1 once to initialize all the collections, if needed.
7 ) You can check File -> Collections to see the Collections preview
8 ) You can also check the test Gallery for the results
Check if it helps @Anonymous
@Anonymous
Try it like this:
Sample Source_collection:
Formula:
NOTE: I am using semicolons as the string delimiter of the sample date string data, to be close to your original example. However, please beware that in my formula, it assumes the "comma" (,) as the delimiter, because the comma is my setting in Power Apps - if you are using Power Apps with semicolon as the delimiter for everything, including for the formulas (such as in another region) and in case you have a different formula delimiter like semicolons, and different formula line ending delimiters, you may have to modify the below formula appropriately for your scenario, region, and use case.
Clear(Destination_collection);
Clear(Intermediate_collection);
ClearCollect(Source_collection,{DateString:"2022/9/1;2022/9/2;2022/9/3"},{DateString:"2022/9/4;2022/9/5;2022/9/6"});
ForAll(
Source_collection As DateStringRecord
,Collect(Intermediate_collection,Split(DateStringRecord.DateString,";"))
);
ClearCollect
(
Destination_collection
,RenameColumns(Intermediate_collection,"Result","Date")
);
If the above gives formula errors (other than because I used commas in my formula and your setting is semicolons, etc. - i.e. if it says something like Destination_collection is not a recognized name as the error):
1. Temporarily change the first two lines to
ClearCollect(Destination_collection,Blank());
ClearCollect(Intermediate_collection,Blank());
2. Trigger the formula to run somehow.
3. Change the first two lines back to
Clear(Destination_collection);
Clear(Intermediate_collection);
You may also choose to just use the "temporary" ClearCollect lines instead, but if you do, there may appear to be a blank "Value" column in the Collection preview of Destination_collection and Intermediate_collection, whereas with this way where the first two lines are just "Clear", this blank "Value" column is not present in Destination_collection and Intermediate_collection.
Collections result:
NOTE: There are 5 items instead of 6 shown, because only a maximum of the first 5 items of a Collection show in the previews under File -> Collections.
There are actually 6 items there, to see all of them, add a Gallery to Screen1, and for Items, use Destination_collection - all 6 items should be there.
Working Sample msapp
I have attached a working sample msapp file app34.msapp if you would like to import a full, working example yourself for your convenience.
To use the sample msapp attached, follow these steps:
1) Download the msapp file attached to this post (it's at the bottom of this post), to Desktop or a folder of your choice, by clicking on it from this post.
2) Create a new, blank Power App Canvas App
3) Go to File -> Open -> Browse
4 ) Navigate to location of .msapp file from Step 1, select it, and press the "Open" button.
5 ) The working example msapp file should load
6 ) Toggle between Screen2 and Screen1 once to initialize all the collections.
7 ) You can check File -> Collections to see the Collections preview
Check if it helps @Anonymous
Hey @poweractivate , thanks for the reply and the answer given. I have tried it out and it works! Thank you.
I got one follow-up question, how can I modify the above solution to include multiple columns from the SharePoint list? So from:
Date Employee
9/08/2022;10/08/2022;11/08/2022 | John;Mark;Troy
To
Date Employee
------------------- ----------
row 1 - 9/08/2022 John
row 2 - 10/08/2022 Mark
row 3 - 11/08/2022 Troy
@Anonymous
Great question!
I have a solution for that below.
I believe this solution is also much improved from the solution I gave first, there is not even an Intermediate_collection anymore, you can check it:
Test sample collections
Date | Employee |
9/08/2022;10/08/2022;11/08/2022 | John;Mark;Troy |
12/08/2022;01/08/2023 | Mike;Jack |
(by the way, I made this solution to support not only semicolon delimited Date and the second column of semicolon delimited Employee, but also, more than one row as well, in case you need that too)
Results in a test Gallery:
Formula:
The main formula, OnVisible of Screen1, is:
NOTE: This formula does not validate if the number of semicolon-delimited elements in both columns are the same, and this can cause unexpected results. Read on further for a version of this formula that does validate if the number of elements are the same!
Clear(Destination_collection);
ClearCollect(Source_collection,{Date:"9/08/2022;10/08/2022;11/08/2022 ",Employee:"John;Mark;Troy"},{Date:"12/08/2022;01/08/2023",Employee:"Mike;Jack"});
Clear(Outer_Temp_count);
Clear(Temp_count);
ForAll
(
///////
ForAll
(
Source_collection As SourceData
,With
(
{
IndividualDates:Split(SourceData.Date,";")
,IndividualEmployees:Split(SourceData.Employee,";")
}
,Collect(Outer_Temp_count,CountRows(Temp_count));ForAll
(
IndividualDates As IndividualDate
,Collect(Temp_count,0);
{
Date :IndividualDate.Result
,Employee:Last(FirstN(IndividualEmployees,CountRows(Temp_count)-Last(Outer_Temp_count).Value)).Result
//,Counts:CountRows(Temp_count)-Last(Outer_Temp_count).Value
}
)
)
) As Intermediate
,Collect(Destination_collection,Intermediate.Value)
///////
);
NOTE: The solution may give unexpected results if the number of delimited elements in Date differs from the number of delimited elements for Employee. For now, the presumption is both should be the same.
Formula that validates the number of semicolon-delimited elements:
Here below is another version of the formula, where it just skips the whole row and shows a red notification error on the screen, if the lengths of the semicolon separated elements of Date and Employee end up not matching on that row.
This is the version of the formula that is actually inside of the attached sample app:
//this version checks to see if the number of elements in each column are the same, and if not, it skips the row and shows an error notification!
Clear(Destination_collection);
ClearCollect(Source_collection,{Date:"9/08/2022;10/08/2022;11/08/2022",Employee:"John;Mark;Troy"},{Date:"12/08/2022;01/08/2023",Employee:"Mike;Jack"});
Clear(Outer_Temp_count);
Clear(Temp_count);
ForAll
(
///////
ForAll
(
Source_collection As SourceData
,With
(
{
IndividualDates:Split(SourceData.Date,";")
,IndividualEmployees:Split(SourceData.Employee,";")
}
,With
(
{RowCounts:Distinct([CountRows(IndividualDates),CountRows(IndividualEmployees)],ThisRecord).Result}
,
If
(
CountRows(RowCounts) > 1
,Notify("The number of delimited elements must match in all columns",Error);Blank()
,Collect(Outer_Temp_count,CountRows(Temp_count));ForAll
(
IndividualDates As IndividualDate
,Collect(Temp_count,0);
{
Date
:IndividualDate.Result
,Employee
:Last(FirstN(IndividualEmployees,CountRows(Temp_count)-Last(Outer_Temp_count).Value)).Result
//,Counts:CountRows(Temp_count)-Last(Outer_Temp_count).Value
}
)
)
)
)
) As Intermediate
,Collect(Destination_collection,Intermediate.Value)
///////
);
Working Sample msapp
I have attached a working sample msapp file app34b.msapp if you would like to import a full, working example yourself for your convenience.
To use the sample msapp attached, follow these steps:
1) Download the msapp file attached to this post (it's at the bottom of this post), to Desktop or a folder of your choice, by clicking on it from this post.
2) Create a new, blank Power App Canvas App
3) Go to File -> Open -> Browse
4 ) Navigate to location of .msapp file from Step 1, select it, and press the "Open" button.
5 ) The working example msapp file should load
6 ) Toggle between Screen2 and Screen1 once to initialize all the collections, if needed.
7 ) You can check File -> Collections to see the Collections preview
8 ) You can also check the test Gallery for the results
Check if it helps @Anonymous
@Anonymous
To add further columns, carefully modify these parts, using the pattern WHATEVER as below - continuing to add similar lines for additional columns, for the following parts:
//pseudocode
IndividualDates:Split(SourceData.Date,";")
,IndividualEmployees:Split(SourceData.Employee,";")
.....
,IndividualWHATEVER:Split(SourceData.WHATEVER,";")
.....
.....
//pseudocode
{RowCounts:Distinct([CountRows(IndividualDates),CountRows(IndividualEmployees),CountRows(IndividualWHATEVER)],ThisRecord).Result}
......
//pseudocode
Date
:IndividualDate.Result
,Employee
:Last(FirstN(IndividualEmployees,CountRows(Temp_count)-Last(Outer_Temp_count).Value)).Result
,WHATEVER
:Last(FirstN(IndividualWHATEVER,CountRows(Temp_count)-Last(Outer_Temp_count).Value)).Result
See if this helps as well @Anonymous
Thank you so much @poweractivate . Tested it out and it works amazing. Thank you for your detailed write ups and suggestions. New to PowerApps and coding in general so it was really helpful!
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!
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 in the Forums 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 of SolutionsSuper UsersNumber of Solutions @anandm08 23 @WarrenBelz 31 @DBO_DV 10 @Amik 19 AmínAA 6 @mmbr1606 12 @rzuber 4 @happyume 7 @Giraldoj 3@ANB 6 (tie) @SpongYe 6 (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. Community MembersSolutionsSuper UsersSolutions @anandm08 10@WarrenBelz 25 @DBO_DV 6@mmbr1606 14 @AmínAA 4 @Amik 12 @royg 3 @ANB 10 @AllanDeCastro 2 @SunilPashikanti 5 @Michaelfp 2 @FLMike 5 @eduardo_izzo 2 Meekou 2 @rzuber 2 @Velegandla 2 @PowerPlatform-P 2 @Micaiah 2 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 Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27 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 Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8 SunilPashikanti8
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.
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