cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sabrina1988
Regular Visitor

how can I get a field value of a previous entered line in Sharepoint based on powerapps?

Hello power Apps Team ^^

I hope someone can help me because I am struggling for a few days...

  • To start, I created an event Sharepoint list composed of these fields:
Event NameMin number of ParticipantsMax Number of Participants
Text fieldNumberNumber

- Then, I created another SharePoint list called Inscription with these fields:

Event NameAttendeeMin ParticipantMax ParticipantStatusRecurrence
Lookup from event Listtext fieldLookup from event ListLookup from the event listConfirmed or Cancelledcalculated en powerapps  

-  I am looking to display a popup msg when the number of lines in the inscription list ( status Confirmed)=max number of participants. I created the recurrence field with the following calculation

CountRows(Filter('Enrollment test 2','Event Name'.Value=DataCardValue2.Selected.Value && Status.Value="Confirmed"))

so if I have 5 lines confirmed in the participant list, recurence=5

For the popup msg, it should be displayed if the number of recurrence= max participant for the selected event name.

The question is: how can I get the max number of participants based on previously entered lines related to the same event name? For example, I have  3 existing lines for event line 'Site' ( status Confirmed) with max participants 3. I start creating a new line in Sharepoint with the same event name 'Site'. When I select it and status 'Confirmed', a pop-up msg should appear mentioning that I reached the max number of participants ( lines insharepoints=max participants). 

 

Thanks for any help,

Sabrina

2 REPLIES 2
C-Papa
Super User
Super User

if you create a collection of the event list it can remain in the backgroud without the user seeing it but it can be refred to in your code. try the following for an idea...

 

Screen OnVisible, ClearCollect(col_events,events)

 

then on your submit button you could add 

Set(var_max_participants, LookUp(col_events, 'Event Name' = DataCardValue2.Selected.Value).'Max Number of Participants'

;If(CountRows(Filter('Enrollment test 2','Event Name'.Value=DataCardValue2.Selected.Value && Status.Value="Confirmed")) <= var_max_participants,Notify( "You have joined the event", NotificationType.Success),Notify( "The event is full", NotificationType.Error))

Sabrina1988
Regular Visitor

Thanks for your reply. Yes, it works with a button :)However, I need to display this error notification when this condition is true(>Max participants) with event name and status selected during the new item creation in the inscription list.. is it possible without using a button?  I don't figure out how to do it without  the onselect button option...

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (4,721)