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 / Concat with Sequence o...
Power Apps
Unanswered

Concat with Sequence order from two Collections

(0) ShareShare
ReportReport
Posted on by

Hi @RandyHayes 

 

You helped me last time with the below code. I would like to continue the sequence with the another Collection 

 

If(Form.Mode<>FormMode.View,
With({_itms: Filter(CollectionA, !IsBlank(SourceName))},
Concat(
ForAll(Sequence(CountRows(_itms)),
{_itm: Last(FirstN(_itms, Value)), seq:Value}
),
Text(seq) & ". " &
"Source Name: " &" "&_itm.SourceName & Char(10) & " "&
"Source Service Type:" &" "&_itm.SourceServiceType & Char(10) & " "&
"Source IP: " &" "&_itm.SourceIP & Char(10) & " "&
"Source Port: " &" "&_itm.SourcePort & Char(10)
)

 

So I would like to continue the number sequence with the Collection B and I also wont know the number of items in this collection too. So for example if from above Collection A is 6, then Collection B will start the sequence at 7 for number of items in this Collection B.

Hope to get a response from you soon.

 

 

Categories:
  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    @indhaa ,

     

    First of all, let me say that I'm really amazed by @RandyHayes solution for your original problem. 

     

    If CollectionA and CollectionB have the same format, the easiest way to achieve your new goal is:

     

    If(Form.Mode<>FormMode.View,
    With({_itms: Filter(Collect(CollectionA,CollectionB), !IsBlank(SourceName))},
    Concat(
    ForAll(Sequence(CountRows(_itms)),
    {_itm: Last(FirstN(_itms, Value)), seq:Value}
    ),
    Text(seq) & ". " &
    "Source Name: " &" "&_itm.SourceName & Char(10) & " "&
    "Source Service Type:" &" "&_itm.SourceServiceType & Char(10) & " "&
    "Source IP: " &" "&_itm.SourceIP & Char(10) & " "&
    "Source Port: " &" "&_itm.SourcePort & Char(10)
    )

     

    but be aware that this approach will alter the values from CollectionA. You can restore the original values in both collection by adding after:

     

    Remove(CollectionA,CollectionB)

     

    Hope it helps !

  • indhaa Profile Picture
    on at

    Hi,

     

    My plan was to merge two collection and use it to Concat. But as you can see, there was an issue and I couldn't do it. That's why checking if I can accomplish Concat and sequence separately like this. I will check if I can do as above too but I think due to other Collection patching the value as table, I might not be able to achieve this. Will let you know

     

    You can refer to my ticket for more info https://powerusers.microsoft.com/t5/Building-Power-Apps/Merge-two-collection-to-another-collection/m-p/1000842#M309973

     

  • indhaa Profile Picture
    on at

    Hi,

     

    So due to this columns I cannot do as you have instructed. The type is below 

     

    Concat(CollectionA, SourceServiceType)

    Concat(CollectionB, SourceServiceType.Value)

     

    This is how the value can be seen inside both collections

     

    Collection A 

    indhaa_0-1626201612025.png

     

    Collection B

    indhaa_1-1626201611439.png

     

      

    can help ? indhaa_2-1626201612313.png

     

     

  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    @indhaa ,

    The usage of Coalesce () function will solve the problem:

    If(Form.Mode<>FormMode.View,
    With({_itms: Filter(Collect(CollectionA,CollectionB), !IsBlank(SourceName))},
    Concat(
    ForAll(Sequence(CountRows(_itms)),
    {_itm: Last(FirstN(_itms, Value)), seq:Value}
    ),
    Text(seq) & ". " &
    "Source Name: " &" "&_itm.SourceName & Char(10) & " "&
    "Source Service Type:" &" "&coalesce(_itm.SourceServiceType,_itm.SourceServiceType.Value)& Char(10) & " "&
    "Source IP: " &" "&_itm.SourceIP & Char(10) & " "&
    "Source Port: " &" "&_itm.SourcePort & Char(10)
    )

     Hope it helps!

  • indhaa Profile Picture
    on at

    Hi

     

    So I'm using this in my DataCard Default property , so I'm getting this error. When I try to implement this on a button, this creates errors every where else because the value type is different.

     

    indhaa_0-1626227109548.png

    If(Form.Mode<>FormMode.View,
    With({_itms: Filter(Collect(CollectionA,CollectionB), !IsBlank(SourceName))},

     

    Also it doesn't accept coalesce too

     

    indhaa_1-1626228177332.png

     

  • indhaa Profile Picture
    on at

    Hi,

     

    So I'm thinking of keeping as it is and get your help with collecting this to another collection. 

    Can get some help on this. This was the root cause of the issue

     

    I did some testing on Concat with both collections and this is how it accept the value.

    Maybe you will know then how to patch values of both collections to one.

     

    Concat(CollectionA, SourceServiceType)

    Concat(CollectionB, SourceServiceType.Value)

     

    This is how the value can be seen inside both collections

     

    Collection A 

    indhaa_0-1626228516891.png

     

    Collection B

    indhaa_1-1626228517417.png

     

      

    indhaa_2-1626228517158.png

     

    When I try to add SourceServiceType column of CollectionB , I'm getting an error

     

    Collect(CollectionC,
    ShowColumns(CollectionB,"SourceServiceType"),  // it is not accepting SourceServiceType from Collection B when I                                                                                       type like that. How to add in here?
    ShowColumns(CollectionA,"SourceServiceType"))

  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    The Collect function do the job for you. If a collection doesn’t have a column when you used collect function it will be created automatically for you. 
    The Coalesce function has the first letter capitalized.

    The problem is that you use the formula inside a non-behavior property (like Text, Fill). I lived with a wrong impression (my bad). So you have to decide where (in a behavior property like on select of a button or on change of a combo box or even on visible of the screen) to collect the info from A and B collection in a new one like

    ClearCollect(CollectionC,CollectionA,CollectionB)

    and replace collectionA with collectionC in Randy’s formula. Also keep the Coalesce function where I put it.

     

     

  • indhaa Profile Picture
    on at

    Hi,

     

    I tried with ' Coalesce' too before I reported the issue. 

    It is the same issue when I tried to merge the two collection. Because the datatype of Collection B as below it is not allowing. How to add for these type? 

     

    indhaa_1-1626250987727.png

     

    indhaa_2-1626251217288.png

    indhaa_3-1626251243261.png

     

     

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 383 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 356

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard