cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
msuser
Frequent Visitor

Each item the record is created , In the gallery if the column with same item is created then update another column with , same name, then name with 1, name with 2, name with 3

I  have a below gallery, here each time record is created, if the designation is the same as other records, here ex :HR

Then it should create another column such that, it will have a name as HR1, HR2,HR3 and so on depending upon record created

 

 

 

 

update name.PNG

 the above gallery should look like this

msuser_2-1631963941224.png

i tried using add column and groupby, but formula didn't work, any help how can i can rename this, like any way, either updating same column as 1, 2 ,3 anything is fine, just need initial help in what formula i can use or any workaround , thank you.

 

Finally, gallery will be looking like this, doesn't matter how we do

msuser_0-1631964454574.png

 

 

 

3 ACCEPTED SOLUTIONS

Accepted Solutions
msuser
Frequent Visitor

Hello @StalinPonnusamy 

 

Thank you so much for taking time and helping with the query, it was very helpful, and grateful to you.

 

I implemented the same steps as you mentioned it and it works perfectly till it counts 10 duplicate records , but after that it will keep repeating with 10, it will not count from 10,

image.png

 

i tested multiple time , one time it took 11 , 12, and other 4 times it got repeated 10 , has above screenshot  and there was no code change done,i used same code as you mentioned, for all test i made,

Let me know if i need to add something . thank you again for your help

View solution in original post

StalinPonnusamy
Community Champion
Community Champion

Hi @msuser 

 

Good testing. I appreciate it.

 

Found the problem and fixed it now. Please try this

ClearCollect(
    ColPreDesignation,
    First(
        SortByColumns(
            Filter(
                'External User',
                StartsWith(
                    Designation,
                    DataCardValue11.Text
                )
            ),
            "ID",
            Descending
        )
    )
);
Set(
    CurrentName,
    If(
        IsBlank(ColPreDesignation) || IsEmpty(ColPreDesignation),
        Blank(),
        First(ColPreDesignation).Designation
    )
);
Set(
    CurrentSeq,
    If(
        IsBlank(CurrentName),
        Blank(),
        Replace(
            CurrentName,
            1,
            Len(DataCardValue11.Text),
            ""
        )
    )
);
Patch(
    'External User',
    If(
        EditForm1.Mode = FormMode.New,
        Defaults('External User'),
        LookUp(
            'External User',
            ID = BrowseGallery1.Selected.ID
        )
    ),
    {
        FullName: DataCardValue9.Text,
        Designation: DataCardValue11.Text & If(
            IsBlank(CurrentName),
            Blank(),
            If(
                IsBlank(CurrentSeq),
                1,
                Value(CurrentSeq) + 1
            )
        )
    }
);

 

Fix: The problem was taking a current item from Datasource. I have added First and Sortbycolumns to ID

 

StalinPonnusamy_0-1632160444180.png

 

View solution in original post

i changed the expression as you mentioned and now it is working perfectly, again thank you so much for your help, it was really great. I never excepted getting solution this fast.

View solution in original post

5 REPLIES 5
StalinPonnusamy
Community Champion
Community Champion

Hi @msuser 

 

Your Patch Command will be

 

ClearCollect(
    ColPreDesignation,
    SortByColumns(
        Filter(
            'External User',
            StartsWith(
                Designation,
                DataCardValue11.Text
            )
        ),
        "Designation",
        Descending
    )
);
Set(
    CurrentName,
    If(
        IsBlank(ColPreDesignation) || IsEmpty(ColPreDesignation),
        Blank(),
        First(ColPreDesignation).Designation
    )
);
Set(
    CurrentSeq,
    If(
        IsBlank(CurrentName),
        Blank(),
        Replace(
            CurrentName,
            1,
            Len(DataCardValue11.Text),
            ""
        )
    )
);
Patch(
    'External User',
    If(
        EditForm1.Mode = FormMode.New,
        Defaults('External User'),
        LookUp(
            'External User',
            ID = BrowseGallery1.Selected.ID
        )
    ),
    {
        Title: DataCardValue9.Text,
        Designation: DataCardValue11.Text & If(
            IsBlank(CurrentName),
            Blank(),
            If(
                IsBlank(CurrentSeq),
                1,
                Value(CurrentSeq) + 1
            )
        )
    }
);

 

 

DataCardValue11 - Designation Text Input

'External User' - SP List Name

Title - Looks like your name Column

 

Sample

StalinPonnusamy_0-1632026706376.png

 

msuser
Frequent Visitor

Hello @StalinPonnusamy 

 

Thank you so much for taking time and helping with the query, it was very helpful, and grateful to you.

 

I implemented the same steps as you mentioned it and it works perfectly till it counts 10 duplicate records , but after that it will keep repeating with 10, it will not count from 10,

image.png

 

i tested multiple time , one time it took 11 , 12, and other 4 times it got repeated 10 , has above screenshot  and there was no code change done,i used same code as you mentioned, for all test i made,

Let me know if i need to add something . thank you again for your help

View solution in original post

StalinPonnusamy
Community Champion
Community Champion

Hi @msuser 

 

Good testing. I appreciate it.

 

Found the problem and fixed it now. Please try this

ClearCollect(
    ColPreDesignation,
    First(
        SortByColumns(
            Filter(
                'External User',
                StartsWith(
                    Designation,
                    DataCardValue11.Text
                )
            ),
            "ID",
            Descending
        )
    )
);
Set(
    CurrentName,
    If(
        IsBlank(ColPreDesignation) || IsEmpty(ColPreDesignation),
        Blank(),
        First(ColPreDesignation).Designation
    )
);
Set(
    CurrentSeq,
    If(
        IsBlank(CurrentName),
        Blank(),
        Replace(
            CurrentName,
            1,
            Len(DataCardValue11.Text),
            ""
        )
    )
);
Patch(
    'External User',
    If(
        EditForm1.Mode = FormMode.New,
        Defaults('External User'),
        LookUp(
            'External User',
            ID = BrowseGallery1.Selected.ID
        )
    ),
    {
        FullName: DataCardValue9.Text,
        Designation: DataCardValue11.Text & If(
            IsBlank(CurrentName),
            Blank(),
            If(
                IsBlank(CurrentSeq),
                1,
                Value(CurrentSeq) + 1
            )
        )
    }
);

 

Fix: The problem was taking a current item from Datasource. I have added First and Sortbycolumns to ID

 

StalinPonnusamy_0-1632160444180.png

 

View solution in original post

i changed the expression as you mentioned and now it is working perfectly, again thank you so much for your help, it was really great. I never excepted getting solution this fast.

View solution in original post

StalinPonnusamy
Community Champion
Community Champion

Hi @msuser 

 

I'm happy to see that the requirement has been fulfilled. 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,910)