Hi community,
I'm creating a Attendance app for my Org, and a basic idea of the app is as follows:
I've created a SP List (datasource).
App UI has 3 buttons. 1)Upload Image. 2)Begin Day. 3) End Day.
The work flow is supposed to be:
Clicking on Upload Image, A new row is created in the List and the Title is set to User's Full name and the Image's URL and a status column is set as "day start".
Begin Day button is supposed to be clicked at a later point of time and a Patch Lookup fxn checks for Title column and if it's !Empty then writes Now() to begin day column and the End Day button works in a similar fashion.
The problem being faced by me is, The upload image button is creating new records, as it should, but the other two buttons are overwriting the data in the 1st row itself again and again. I'm unable to set any condition so that the data gets updated in the newly created row created by the upload image button.
Plz help me out.
Solved! Go to Solution.
Hi @Anonymous ,
Cutting through to the relevant bits, your Upload
creates a new record in the table CyAt with
Your next two items refer in the lookup to only the username as a match for the record and not the date (which I assume is needed). The first one also has a second condition that would overwrite the first patch. I suspect you need something like this.
With(
{
wOther:
If(
Dropdown1.SelectedText.Value = "Others: SPECIFY",
TextInput1.Text,
Blank()
),
wUser:User().FullName
},
UpdateIf(
CyAt,
Title = wUser && Text(vatDT, ShortDate) = Text(DateOfEntry,ShortDate)
{
'Work Location': Dropdown1.Selected,
DST: Now(),
Scoord: Label3.Text,
status: "In",
OtherLocation:wOther
}
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @Anonymous ,
Please supply the code on the OnSelect of these three buttons.
Hi, @WarrenBelz
Code on Upload Image button is
Set(varASS, JSON(Image1.Image, JSONFormat.IncludeBinaryData));
Set(varBase64Only, Mid (varASS, Find(",", varASS)+1, Len(varASS) - Find(",", varASS) -1));
Set(varASSLink , ASSUpload.Run(Last(AttachmentControl.Attachments).Name, varBase64Only).assfilelink);
Set(varDT, Now());
Set(ItemID, Patch(CyAt, Defaults(CyAt), {Title: User().FullName, DateOfEntry:varDT, asimg: varASSLink, status: "Day Start"}));
Reset(AttachmentControl);
Navigate(Done, ScreenTransition.Cover)
Code on Day Start button is:
Patch(
CyAt,
LookUp(
CyAt,
(Title = User().FullName),
{
'Work Location': Dropdown1.Selected,
DST: Now(),
Scoord: Label3.Text,
status: "In",
}
);
If(
Dropdown1.SelectedText.Value = "Others: SPECIFY",
Patch(
CyAt,
LookUp(
CyAt,
Title = User().FullName
),
{otherLocation: TextInput1.Text}
)
)));
Reset(TextInput1);
UpdateContext({varShow: false});
Navigate (
Done,
ScreenTransition.Cover
);
Code on Day End button is:
Patch(
CyAt,
LookUp(
CyAt,
Title = User().FullName
),
{
DET: Now(),
Ecoord: Label3.Text,
status: "Out"
}
);
Navigate(
Screen2,
ScreenTransition.Cover
)
Hi @Anonymous ,
Cutting through to the relevant bits, your Upload
creates a new record in the table CyAt with
Your next two items refer in the lookup to only the username as a match for the record and not the date (which I assume is needed). The first one also has a second condition that would overwrite the first patch. I suspect you need something like this.
With(
{
wOther:
If(
Dropdown1.SelectedText.Value = "Others: SPECIFY",
TextInput1.Text,
Blank()
),
wUser:User().FullName
},
UpdateIf(
CyAt,
Title = wUser && Text(vatDT, ShortDate) = Text(DateOfEntry,ShortDate)
{
'Work Location': Dropdown1.Selected,
DST: Now(),
Scoord: Label3.Text,
status: "In",
OtherLocation:wOther
}
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Thanks for the reply @WarrenBelz, but somehow the data is not being written to the SP List on clicking on the Day Start Button (I changed the vatDT to varDT).
@Anonymous ,,
I also now noticed that on the Patch Dropdown1.Selected should be Dropdown1.Selected.Value
This is a fairly simple process - ensure my logic is also correct (the date and the user need to match to find the correct record).
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
187 | |
52 | |
51 | |
36 | |
33 |
User | Count |
---|---|
283 | |
97 | |
90 | |
82 | |
77 |