cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Troubles with collections

I am building a Time Card application. I have several collections

MY CREW

MY WORKORDERS

TimeCard Transaction

Hours

 

I have a gallery for the workorders and crew list

I have a colletion that created when selecting a crew member it knows who is selected and who is not

I have a variable created when a workorder is selected

Another variable is TimeType ST (Strait Time), OT (Over TIme), DT (Double Time)

Instance is equivelent to a date 

 

When I select one or more crew members I try to use the ForAll to update any existing records in the collection for the same crew member on the same day and same work order I just want to update the Hours for that record, if there is no record I want to add a new record.

 

I first started out that if you select a work order from the work order gallery, then for when you select a crew member it will update an existing record if it exists or add a new record if it does not exist. That worked fine. This is all being done on the app locally. And when the day is done the user can push a button and all records get sent to a SQL Server on Premis.

 

I want to make a feature that the user first selects all the crew members that he wants to update or add a new record and then push a button and the ForAll will go through each employee that is selected and add it to the collection or update the collection.

 

I have been strugling with this for many hours and with no success.

 

Need some advice.

 

Thanks in advance.

1 REPLY 1
Anonymous
Not applicable

Here is the syntax I am using to try to update the entire table if the user selects "ST".

When I have a list of three employees selected, creates one record and then stops.

I need it to continue through the collection.

 

 

If(First(vTimeType).Value="ST",
ForAll(EMP_ISSELECTED,If(IsBlank(LookUp(Filter(loc_Sav_TCARD_TCTRANS,EMPID=EMPID,WORKORDER=First(vWONBR).Value,INSTANCE=First(vInstance).Value),EMPID>0))=true,
Collect(loc_Sav_TCARD_TCTRANS,{EMPID:EMPID,WORKORDER:First(vWONBR).Value,INSTANCE:First(vInstance).Value,ST:Value(First(vCALC).Value),OT:0,DT:0}),
UpdateIf(Filter(loc_Sav_TCARD_TCTRANS,EMPID=EMPID,INSTANCE=First(vInstance).Value,WORKORDER=First(vWONBR).Value),EMPID>0,{ST:Value(First(vCALC).Value)}))));
SaveData(loc_Sav_TCARD_TCTRANS,"loc_Sav_TCARD_TCTRANS")

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (20,123)