cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Prodigy
Post Prodigy

Notification success / DisplayName

Hello,

 

If(
    User().Email in Split(
        ThisItem.'Kto polubił';
        ";"
    );
    Notify("Możesz polubić propozycję tylko raz."; NotificationType.Error);
    Patch(
        IdeaBox_1;
        ThisItem;
        {
            Polubienia: ThisItem.Polubienia + 1;
            'Kto polubił': ThisItem.'Kto polubił' & ";" & User().Email
        }
    ))

 

 

I have this function on my button - it is for LIKE functionality.

 

I have two problems.

 

1) I have no idea how to add NotificationSuccess when patch action is sucessful.

One of the users tried to help me, but his solutions failed.

 

I would like to add a message:

 

Notify("Polubiono!"; NotificationType.Success);

 

Is that possible? 

 

 

Set(varRecord, Patch(your_code_here));
If(!IsBlank(varRecord),
    Notify("Your request has been submitted!", Notification.Success),
    Notify("Your request was not submitted", Notification.Failure)
);

 

I found this function but I have problems in using that.

 

Another question is that I have this sharepoint field 'Kto polubił' (who liked)

Is stores users e-mails and prevent them from liking propositions more than once (function Notification Failure)

It stores emails like that:

email;email;email

 

I would like to use this field to show list of users that liked. I made gallery, table, tooltip and others with this field and it worked! But it shows e-mail address. Is it possible to reformat this field to shows users name as it is more clear? In my organisation e-mails are a lot different from names.

25 REPLIES 25

Hi @Elitezone 

 

I am glad that it worked. 

for the second part can you please briefly describe the business need for it and its requirements 

Also this function is triggered by another button, right ? (You are not mixing formulas )

I would appreciate to send me this formula after changing the browser language to English for quicker troubleshooting.

 

Best Regards

Mark

@Mark-Shenouda 

Quick explanation.

The formula that you created is on button in Gallery. It is on every record and allows to like it.

Gallery have Items formula like that:

 

 

Sort(Filter(Search(AddColumns(IdeaBox_1,"AuthorName",'Utworzone przez'.DisplayName,"CategoryCombo",Kategoria.Value),SearchBox.Text,"Nazwa","Opis","AuthorName"), 

(If(IsBlank(Last(FirstN(ComboBox2.SelectedItems.Value,1)).Value),true, Last(FirstN(ComboBox2.SelectedItems.Value,1)).Value in Kategoria.Value)||
If(IsBlank(Last(FirstN(ComboBox2.SelectedItems.Value,2)).Value),true, Last(FirstN(ComboBox2.SelectedItems.Value,2)).Value in Kategoria.Value)||
If(IsBlank(Last(FirstN(ComboBox2.SelectedItems.Value,3)).Value),true, Last(FirstN(ComboBox2.SelectedItems.Value,3)).Value in Kategoria.Value))

&&(Utworzony) >= DatePicker1.SelectedDate && (Utworzony) <= DatePicker2.SelectedDate +1), Utworzony, If(SortDescending2,Descending,Ascending))

 

It allows to filter data through combobox value, datepickers, text input field and asc/desc date button.

A lot of filters I would say but required by my users.

 

Your formula work when Gallery has formula in Items - IdeaBox_1 (just indicating data source), when I tried to use mine formula as before - Gallery works, but your function is destroyed. It has errors - Patch has invalid arguments and specified column AuthorName does not exist.

It has to be because of creation of table AuthorName in gallery. One of the users told me once:

 

Since I AddTable changes structure of gallery items that add a new text column to IdeaBox_1, so in the Patch formula you post above, 'ThisItem' is not compatible with the IdeaBox_1 any more. Please change to use LookUp function to retrieve the record based on the ThisItem.ID.

You can use it like that:
    Set(varRecord;Patch(
        IdeaBox_1;
        LookUp(IdeaBox_1,ID=ThisItem.ID);  // Modify here!!
        {
            Polubienia: ThisItem.Polubienia + 1;
            'Kto polubił': ThisItem.'Kto polubił' & ";" & User().FullName & ";" & User().Email
        }
    ));


and in detail view of Gallery2.Selected:
LookUp(IdeaBox_1,ID= Gallery2.Selected.ID)

 

 

Could you please help with this LookUp or another solution. 

I do not mix any formulas.

Hi @Elitezone 

 

I am assuming you have a lookup field and you need to enable the search functionality in these lookup

You can user the filter with the lookup fields as below 

Filter(datasource,LookupFieldName.Value ="SearchValue")

You can try this formula to filter your data ,

Also may I ask why are you using Filter and Search together what is the functionality that you are trying to implement.

 

Best Regards 

Mark

 

 

 

 

 

@Mark-Shenouda 

This function in my gallery:

 

Sort(Filter(Search(AddColumns(IdeaBox_1,"AuthorName",'Utworzone przez'.DisplayName,"CategoryCombo",Kategoria.Value),SearchBox.Text,"Nazwa","Opis","AuthorName"), 

(If(IsBlank(Last(FirstN(ComboBox2.SelectedItems.Value,1)).Value),true, Last(FirstN(ComboBox2.SelectedItems.Value,1)).Value in Kategoria.Value)||
If(IsBlank(Last(FirstN(ComboBox2.SelectedItems.Value,2)).Value),true, Last(FirstN(ComboBox2.SelectedItems.Value,2)).Value in Kategoria.Value)||
If(IsBlank(Last(FirstN(ComboBox2.SelectedItems.Value,3)).Value),true, Last(FirstN(ComboBox2.SelectedItems.Value,3)).Value in Kategoria.Value))

&&(Utworzony) >= DatePicker1.SelectedDate && (Utworzony) <= DatePicker2.SelectedDate +1), Utworzony, If(SortDescending2,Descending,Ascending))

 

1. Allow to search through date range pickers (DatePicker1 and DatePicker2)

2. Allow to serach through input field SearchBox.Text - it search through few sharepoint fields - Name (Nazwa), Description (Opis), AuthorName - custom table added to gallery to allow search through input.

3. Allow to search date asc/desc with a button SortDescending2

4. Allow to search through combobox (ComboBox2)

 

I didn't know how to add to SearchBox searching through AuthorName and one user modified my function with this AddTable. He told me to do things with LookUp - I didn't do that myself.

This was the topic: https://powerusers.microsoft.com/t5/Building-Power-Apps/Filter-modification-Search-text-input-in-fie...

 

This function works perfectly. I do not need any changes.

It is however interfering with your function that is gathering likes. Errors are like I stated above.

I cannot fix it myself so I either have to delete AddTable AuthorName or you help me implement some changes.

 

I also am very bad with sort/filter functions. They are the worst in PowerApps for me.

Please instruct what to do in your function to make this works ;(

Hi @Elitezone 

 

Try to replace the last patch line 

Patch(IdeaBox_1;ThisItem;{WhoLikedPeople:TempTable});)

with the below line 

Patch(IdeaBox_1,LookUp(IdeaBox_1,ID=ThisItem.ID),{WhoLikedPeople:TempTable});)

 

Best Regards

Mark

View solution in original post

@Mark-Shenouda 

It works. I have a little problem with resetting this field value, but I'll ask in another topic.

Thank you!

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (6,677)