I have a problem with my PowerApps application.
I get an error on line 16. The error is placed on the semicolon.
I have already tried a comma, an @ and whitespace but nothing works.
Can anyone help me?
Here is the code:
Patch(
workshop;
Defaults(workshop);
{
Titel: DataCardValue1.Text;
room: DataCardValue2.Text;
description: DataCardValue3.Text;
start: Text(HourInputStart.Value) & Text(MinuteInputStart.Value);
end: Text(HourInputEnd.Value) & Text(MinuteInputEnd.Value);
language: DropdownLanguage.Selected.Value;
capacity: CapacityInput.Value;
employeeId: Text(User().EntraObjectId);
swisscomLocationsId: (1);
teamsMeeting: DataCardValue11.Text
}
);
ForAll(
Sequence(CapacityInput.Value);
Patch(
workshop_booked;
Defaults(workhop_booked);
{
Titel: "Irrelevant";
WorkshopID: "12";
WorkshopCreator: Text(User().EntraObjectId);
ChildName: "";
ChildNumber: "";
}
)
)
Best Regards
Patrick :smiley:
user23469609 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
From the sample code you provided, there are couple of issues to be addressed.
-
With the syntax used for separating arguments in your functions.
PowerApps uses semicolons (;) in some contexts and commas (,) in others, depending on the locale settings. You should use commas (,) instead of semicolons between the arguments of the Patch and ForAll functions. -
In PowerApps, “Start” and “End” are reserved words, and using them as field names can cause syntax errors. this can be fixed by adding “[@]”
-
Also If the above fix doesn’t work, check your PowerApps environment’s for the right locale settings. The separator might differ based on your regional settings.
I also noticed that you have some typos which might not be an issue. but you should update your references and make sure they are correctly spelled, e.g., workshop_booked instead of workhop_booked.
find the updated code below :
Patch(
workshop,
Defaults(workshop),
{
Titel: DataCardValue1.Text;
room: DataCardValue2.Text;
description: DataCardValue3.Text;
start: Text(HourInputStart.Value) & Text(MinuteInputStart.Value);
end: Text(HourInputEnd.Value) & Text(MinuteInputEnd.Value);
language: DropdownLanguage.Selected.Value;
capacity: CapacityInput.Value;
employeeId: Text(User().EntraObjectId);
swisscomLocationsId: 1;
teamsMeeting: DataCardValue11.Text
}
);
ForAll(
Sequence(CapacityInput.Value),
Patch(
workshop_booked,
Defaults(workshop_booked),
{
Titel: "Irrelevant";
WorkshopID: "12";
WorkshopCreator: Text(User().EntraObjectId);
ChildName: "";
ChildNumber: "";
}
)
);
Since you are using ;
to separate the arguments of the call to the ForAll and Patch function, I’m assuming you are in a locale which uses ,
as the decimal separator for numbers. In that case, if you want to have multiple functions, you should use ;;
as the chaining operator:
Patch(
workshop;
Defaults(workshop);
{ ... }
);;
ForAll(
Sequence(CapacityInput.Value);
Patch(...)
)
Take a look at https://learn.microsoft.com/power-apps/maker/canvas-apps/global-apps#formula-separators-and-chaining-operator for more details.