web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Migrating data to a li...
Power Apps
Unanswered

Migrating data to a list + data manipulation to make a calendar

(0) ShareShare
ReportReport
Posted on by 21
Hi there! This is going to be a bit of a mess of questions but hopefully things will make sense. I'll try to be as concise as possible. I'll split it into 2 parts...

PART 1:
I'm building an app that is supposed to build a calendar of project events/jobs to do in Lists submitted by people outside my office. Essentially, they fill out a form that tells me about a particular project and the major deadlines it has, then spits out a a calendar with each of the events bookending each other, so I can rate each event later by difficulty to complete.
 
I'm starting first with the list, then linking it to the app, because there are some choice columns I would prefer to control in Lists (Project Approval status and Event Difficulty Rating). The app fills these columns in a couple of different ways...

Screen 1: Data that cascades into ALL events (or records to be technical)
These inputs include things like Project names, descriptions, the submission author (user record), and a couple of other details. These items are saved as single variables. In total, 7 items are stored be added to the list later.
 
Screen 2: Event-specific data
This screen allows the user to specify the major events occurring during a project, which dictates the number of records to add to the list. This is saved as a collection. The collection asks for 3 items per record on this screen.

Screen 3: Review and submission
This screen will display the 7 items from Screen 1, along with a gallery that shows the collection from screen 2. When the user hits "submit", this is what I would like to have happen:
 
A). For the collection from screen 2, add the 7 items from screen 1 to each record, so each record now has 10 items instead of 3. 
B). Migrate the data from this collection to the List, so that the data from the collection falls into an existing column pre-provided by the list. I do NOT want the app to create columns upon submission.
C). The List has 2 columns the collection will not fill. These are the aforementioned "Project Approval Status" and "Event Difficulty Rating" choice columns provided by the list. When submitting, set the value of these columns to a default choice for every record being added to the list.
 
Part 2 is a little trickier...

PART 2:
Since one of the goals is to take each submission and turn it into a calendar, you can think of each record in the list as an event. Each record needs a start and an end date to fill the calendar, but what is being provided by the app is ONLY the due date of the event, NOT the start date. I would like the start date to be the due date of the previous event. For example...
 
Event Name Key Date
Presentation 1 5/26
Presentation 2 6/13
 
Needs to become...
 
Event Name Start Date End Date
Presentation 1 Project start (from screen 1 input, 1 of the 7 variables) 5/26
Presentation 2 5/26 6/13

Note, too, that these entries may not be entered into the collection in order, so I assume some type of sorting would need to happen first. 


If anyone knows how to answer one or both of these questions, that would be so helpful. Or, provide a more efficient solution than what's being described. I cal also try to illustrate better what the exact ask is. Thank you!
 



 
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at
     
    Apologies, I am not 100% sure I understand. Are you saying that what you typed for Part 1 is a question? I am just not sure what you are asking about if so.
     
    But you wrote
     
    Part 1
     
    A). For the collection from screen 2, add the 7 items from screen 1 to each record, so each record now has 10 items instead of 3. 
    You said on screen to, every record has 3 items. I think you mean 3 properties, otherwise I don't follow
     
    So do you mean each record now has 10 properties instead of 3?
     
    Why not just use a single Collection that has all the placeholder "names/value" in them, then from Screen one pass it to screen 2, where the parts from Screen 1 are already filled in, then fill in the rest from screen 2.
     
    A collection has Items in it, when you say records have items its the wrong terminology. You have 1 Item, which has 10 properties. So again just create a Collection in Screen 1 of your wizard. Then pass that as a Context variable in your Navigate call to Screen 2
     
     
    B). Migrate the data from this collection to the List, so that the data from the collection falls into an existing column pre-provided by the list. I do NOT want the app to create columns upon submission.
     
    No one ever has the app create columns, it cannot, well it has no built in functionality to do so, it would require effort to do this. But iterating through the Collection to Patch the records to the List is easy. It depends on whether you do a For All loop and patch them 1 by 1 or if you can support doing a single Batch Patch
     

    C). The List has 2 columns the collection will not fill. These are the aforementioned "Project Approval Status" and "Event Difficulty Rating" choice columns provided by the list. When submitting, set the value of these columns to a default choice for every record being added to the list.
     
    You don't need it to do this, just set the default in the Column and it will default automatically, no need to try to make your code do it, especially since you said, the collection will not fill it, aka, you don't have values for it in the collection, no worries, again in SharePoint just set the Default
     
    But I am still not sure what Help you are asking for. I do not see a question. You simply have descriptions (and pretty decent ones) of what you plan to do, so what is the actual question for Part 1? I added some thoughts but that is about it.
     
    Part 2
     
    Since one of the goals is to take each submission and turn it into a calendar, you can think of each record in the list as an event. Each record needs a start and an end date to fill the calendar, but what is being provided by the app is ONLY the due date of the event, NOT the start date. I would like the start date to be the due date of the previous event. For example...
     
    I appreciate the description but again I do not see any specific question. You notes are easy to follow and should be easy to do searches for questions, and I am happy to help but I do not follow, help with what?
     
    As for your statement above, are the items in the collection all related to each other? Or are they possibly related to things already in the List? This is important. If you say you want the Start Date to be the End date of the previous action, but the previous action is in the List already, then you have to go get it to get that date, which is easy.
     
    If its simply Dates that are in your Collection, then I would say you need to sort by Due Date (ASC)
    The issue I see though, is that the 1st item in the collection won't have a "previous" record (at least in the collection) by which to grab the Due Date from. So you'd have to get it from somewhere.
     
    Imagine you are the first person ever filling this in... you have no items in the List to grab the Start Date from, so how do you figure that one out? No idea whats up to your own business logic needs. If they are all in the Collection its easy, as you simply have to grab the previous Ordinal (Index) in the collection and grab its date. Since you want this set, you can do that, or use a Calculated Column as long as THIS particular batch of items in the collection have some unique way of identifying they are a batch together, and to use only those dates.
     
    But truthfully I am still not sure what the questions are :-0( to be more specific.

    So please feel free to write specific detailed questions for me/us to respond to
     
  • TP-11112120-0 Profile Picture
    21 on at
    Hi there @Michael E. Gernaey! Thanks for the response. Yes, I apologize for the convolution, but I think a lot of what you said actually helps point out a lot of things. I'm new to PowerApps so it's taking me a little while to grasp the proper terminology...and how some of it works.

    We'll start at part 1. I'll try to rephrase it as a single question:
     
    I need to compile a collection with 10 columns to dump into a list. There is a collection with 3 properties, and I need to add 7 more to fill in with saved variables. What's the best way to do this?

    From what I gather, it sounds like you're saying just start with a collection straight away, correct?

    Part 2  I'll try to rephrase this one too:

    Each entry in the collection is supposed to be an event in a calendar. End dates are recorded from the user's input, but the start date of an entry needs to be the end date of the previous entry. What's the best way to do this? And the caveat is that the user may not put the entries in proper sequence, hence the note on the need for sorting.

    From you:
    "As for your statement above, are the items in the collection all related to each other? Or are they possibly related to things already in the List? This is important. If you say you want the Start Date to be the End date of the previous action, but the previous action is in the List already, then you have to go get it to get that date, which is easy."
     
    I think this statement hits closest to where the answer needs to go. The items in the collection are related to each other. They have no relation to existing items in the list.

    Hopefully that simplifies things a bit! And thanks for the patience, I sincerely appreciate the time you took to dissect that.


     
  • Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at
     
    Thank you for the responses.
     
    Let me start again with Part 1.
     
    I am a firm believer in 2 things(lol ok more than that),
    1) avoid globals if you can, its not required, but as you build things for Mobile, collections sit around and take up resources and as you know those are finite.
    2) If I am building a wizard of sorts, I'd prefer to pass the data from one to the other.
     
    So when I said a collection, actually I didn't mean create one and then pass it I meant pass a collection so it would look something like this (and btw, everyone has their preferences as you could just access the data from this screen on another (possibly).
     
    Pretend we have 3 Text Inputs and I filled them in
    Text1, Text2 and Text3
     
    From Screen 1 to Screen 2
    Navigate(Screen2, Transition,None, {  _InitialFields: { Field1: Text1.Text, Field2: Text2.Text, Field3: Text3.Text }    }); 
     
    But its not a requirement but thats what I was discussing,. You could simply pass the values, or pass .Selected in a Gallery or Form etc, Each scenario will determine how best to pass it.
     
    So I am good, even if you say, well its just easier for me to create a Collection, in the OnSelect of the button/Icon that takes me to screen 2 so you would do
     
     
    ClearCollect(MyCollection,
                     {
                           Field1: Text1.Text,
                           Field2: Text2.Text,
                           Field3: Text3.Text,
                           Field4: Blank() (and add 5-10 blank the same)
                     }
    );
     
    Navigate(Screen2, Transition.None); And in this case I dont need to pass the collection because its global, so if thats easier for you initially go for it.
    And Note: I always just type Transition.None, you can pick any transition you want or if you are NOT passing a value at all, you can leave it off.
     
    Part 2:
     
    Ok great if they are not related, but you need them sorted by Due Date, which I am assuming is going to be ASC (again this makes figuring out the first records Start Date difficult as you do not have a previous value to pick, so youll have to figure that out, or ask another question.,
     
    There are many different ways to tackle this.
    But I would do something like this
     
    ForAll(Sort(MyCollection, DueDate, SortOrder.Ascending,
             Now in here you would patch the back end, but we still need to update the Start Date
     
     
    );
     
    I have to go for a minute Ill be back to finish
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard