Hi,
I have a table with 15k record in sql server. and I wanted to updated and insert records using power apps. Please find below code and suggest.
Sometimes records are getting inserted and updated and sometimes not.
Please suggest.
ForAll(
Gallery3.AllItems,
If(
IsEmpty(
Filter(
StatsPackActualInput,
FinancialYear = FinYear And SiteID = SiteIDVar And CostLineGrandParent = CostLineGrandParentVar And Department = DepartmentVar And CostLineParent = CostLineParentVar And CostLineDescription = CostLineDescriptionVar And WeekNumber = Value(TextInput1.Text)
)
),
Patch(
StatsPackActualInput,
Defaults(StatsPackActualInput),
{
FinancialYear: FinYear,
SiteID: SiteIDVar,
Department: DepartmentVar,
CostLineGrandParent: CostLineGrandParentVar,
CostLineParent: CostLineParentVar,
CostLineDescription: CostLineDescriptionVar,
WeekNumber: Value(TextInput1.Text),
Actual: Value(TextInput4.Text)
}
),
Patch(
StatsPackActualInput,
First(
Filter(
StatsPackActualInput,
FinancialYear = FinYear And SiteID = SiteIDVar And CostLineGrandParent = CostLineGrandParentVar And Department = DepartmentVar And CostLineParent = CostLineParentVar And CostLineDescription = CostLineDescriptionVar And WeekNumber = Value(TextInput1.Text)
)
),
{Actual: Value(TextInput4.Text)}
)
)
);
UpdateContext({Popup: true})

Report
All responses (
Answers (