cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mmattar
Responsive Resident
Responsive Resident

How to split a value from a collection

Hello all,

 

I am trying to Split a value from a collection, example of the value from the collection: "4/16/2020 12:00 AM". I am trying to pick piece this string into  "4/16/2020" "12:00", and "AM" without using extra labels, I achieved this by storing the collection value into a label and then referring to the label i picked  the value apart. How can I do it straight from grabbing it from the collection itself.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
mmattar
Responsive Resident
Responsive Resident

If anyone facing the same issue as i am, i just found it easier to store the split pieces as a variable rather than AddColumns to a collection, the addcolumns seems to be limited to what it can actually do. 

View solution in original post

5 REPLIES 5
mdevaney
Super User
Super User

@mmattar 

You could ADDCOLUMNS to your collection like this.  Then you could reference those columns in wherever needed.

AddColumns(
    your_collection_name,
    "Date", First(Split(your_column_name, " ")).Value,
    "Time", FirstN(Split(your_column_name, " "),2).Value,
    "AMPM", Last(Split(your_column_name, " ")).Value
);

 

Please let me know if you require more advice 🙂

mmattar
Responsive Resident
Responsive Resident

How can i go about adding these columns at the sametime as a OnSelect of a Gallery occurs that populates the collection  

@mmattar 

I would say to put the code I gave in the OnSelect property of the button.

mmattar
Responsive Resident
Responsive Resident

Hey yes i actually figured that part out, i am now noticing an error saying (Invalid Argument Type DateTime, Expecting Text). I wrapped it all in a Text() function and its still not working

mmattar
Responsive Resident
Responsive Resident

If anyone facing the same issue as i am, i just found it easier to store the split pieces as a variable rather than AddColumns to a collection, the addcolumns seems to be limited to what it can actually do. 

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (4,137)