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 Apps / ShowColumns and AddCol...
Power Apps
Answered

ShowColumns and AddColumns

(0) ShareShare
ReportReport
Posted on by 68

Dear All,

 

I'm having difficulty adding a new column to a collection.

FaultLog is my SharePoint data source.

SubmitDate is in the format ddd dd/mmm/yy (eg MON 28/SEP/20).

I'm wanting to create a new Column "Month" with just the month extracted from SubmitDate.

 

Reading the documentation I'm reasonably sure I need to use "AddColumns" but can't seem to get it to work in conjunction with ShowColumns

 

Here's what I have for "OnVisable";

 

ClearCollect(
FaultReportColl,
ShowColumns(
FaultLog,
"SubmitDate",
"Description",
"Title"
)
)

 

Thanks for looking,

 

Ad.

Categories:
I have the same question (0)
  • Vijay Tailor Profile Picture
    2,961 on at

    HI @SydEng ,

    You can Add New Column Like below,>

    ClearCollect(FaultReportColl,AddColumns(MenuDataColl,"Month",Text(Today(),"[$-en-US]mmm")));



    VijayTailor_0-1601278747574.png

    Hope this solution helps you to resolve your issue.
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • SydEng Profile Picture
    68 on at

    Thanks @VijayTailor,

     

    To be honest I didn't think to make it a separate line, I was trying to make it all in one line.

     

    Using your post (and just Collect on my show columns) I've now got a "Month" column but I can't see reference from the SubmitDate? When I look at the collection all of the months are Sep, not Jul, Aug and Sep as I was hoping.

     

    Here's what I have now:

    ClearCollect(FaultReportColl,AddColumns(FaultLog,"Month",Text(Today(),"[$-en-US]mmm")));
    Collect(FaultReportColl,ShowColumns(FaultLog,"SubmitDate","Description","Title"))

     

    Cheers,

    Ad

  • Vijay Tailor Profile Picture
    2,961 on at
    The below code is enough then.
    ClearCollect(FaultReportColl,AddColumns(FaultLog,"Month",Text(Today(),"[$-en-US]mmm")));

    if still your issue not resolved plz, share the error details or reference image for the same
  • SydEng Profile Picture
    68 on at

    @VijayTailor 

    Thanks for persisting with my problem. Reading the code as best I can I don't see where the link is between the SubmitDate column and and Month column. Here's my table that shows the top line having an August submit date.

     

     

    Collection.png

     

    My thoughts are something along the lines of:

    ClearCollect(FaultReportColl,AddColumns(FaultLog,"Month",SubmitDate   (something here)   Text(Today(),"[$-en-US]mmm")));

     

    Is there a way to remove the day and year info from the SubmitDate column?

     

    Kind regards,

     

    Ad

  • Vijay Tailor Profile Picture
    2,961 on at
    Ohk I Understand your Concern.
    but i want your confirmation like what is the type of Column "SubmitDate" like single tine text 0r Date type.

    Once you confirm for me , I will work on your issue.
  • SydEng Profile Picture
    68 on at

    Dear @VijayTailor ,

     

    Lucky I'm just about to go home for the day here (Australia).

     

    It's a Sharepoint list as "single line of text".

     

    Cheers,

     

    Ad

  • Vijay Tailor Profile Picture
    2,961 on at
    Ohk Sure, I will post your solution asap. Thanks
  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @SydEng ,

    So your field format is like this MON 28/SEP/20?

    If you want to get "9" from MON 28/SEP/20, you could try this formula:

    ClearCollect(FaultReportColl,
     AddColumns(FaultLog,"Month",
     Month(
     DateValue(
     Last(
     Split(SubmitDat," ")
    //split MON 28/SEP/20 to two parts: MON and 28/SEP/20
     ).Result
    //get this part 28/SEP/20
     )
    //transfer text to date type
     )
    //get month from date
     )

    If you want to get "Sep" from MON 28/SEP/20, you could try this formula:

    ClearCollect(FaultReportColl,
     AddColumns(FaultLog,"Month",
     Left(
     Last(
     FirstN(
     Split(Label4.Text,"/"),
    //split MON 28/SEP/20 to MON 28,SEP,20
     2
     )
     ).Result,
    //get SEP
     1
    //get S
     )&
     Lower(
     Right(
     Last(FirstN(Split(Label4.Text,"/"),2)).Result,
    //get SEP
     2
    //get EP
     )
     )
    //get ep
    )

     

     

    Best regards,

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 Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard