Thank you for visiting my site!

Patch

Check if record exists

[code]

UpdateContext({varIsRecord: false});

UpdateContext({varIsRecord: If(CountRows(Filter(‘DS’, colName = "something" && colName2="something2"))> 0, true) } );

or

If( IsBlank(
LookUp(
‘[mppc].[LocEvents]’,
EventName = DataCardKey4.Text
)),
SubmitForm(EditForm1),
UpdateContext({Popup: true})
)
[/code]

Patch

[code] // do a patch after a form submit
SubmitForm(frmEdit);
UpdateContext({recordSubmitedDetail: frmEdit.LastSubmit});

If(
recordSubmitedDetail.ID > 0,
Notify(
"Notification – Form submitted.",
NotificationType.Success,
2000
);

//Do a Patch

,
Notify(
Concat(Errors(‘DS’), Column&": "&Message),
NotificationType.Error,
1000
)
);

[/code] [code] //Do a Patch
//Check if there is a record already in the Budget summary Totals
UpdateContext({varIsSummaryTotalsRecord: false});
UpdateContext(
{
varIsSummaryTotalsRecord: If(
CountRows(
Filter(
‘DS’,
FiscalYear = FiscalYear_val_1.Selected.Value && MSBOrg = varGlobMSBOrg
)
) > 0,
true
)
}
);
//If none add the ‘total summaries’
//Else Update the ‘Total summaries’
If(
varIsSummaryTotalsRecord,
Patch(
‘DS’,
First(
Filter(
’00A_Budget_Summary_Totals’,
FiscalYear = FiscalYear_val_1.Selected.Value && MSBOrg = varGlobMSBOrg
)
),
{
FYRequested: varSumSummaryFYRequested,
MSBControl: varSumSummaryMSBControl,
CurrentFiscalYearRequestUnfunded: varSumSummaryCurrentFiscalYearRequestUnfunded
}
),
Patch(
‘DS’,
Defaults(’00A_Budget_Summary_Totals’),
{
FiscalYear: FiscalYear_val_1.Selected.Value,
MSBOrg: varGlobMSBOrg,
FYRequested: varSumSummaryFYRequested,
MSBControl: varSumSummaryMSBControl,
CurrentFiscalYearRequestUnfunded: varSumSummaryCurrentFiscalYearRequestUnfunded
}
)
);

[/code]

Even Better
[code] Patch(DS,
Coalesce(LookUp(DS,
fieldName = DataCardValue.Text),Defaults(DS)
),
{
Title: Title_val.Text,
Required: Required_val.Text
}
);

If(!IsEmpty(Errors(‘DS’)),
// if true, show any error message
Notify(
Concat(Errors(‘DS’), Column&": "&Message),
NotificationType.Error
),
// else, go to success screen
Navigate(‘scr’);
[/code]

ADD YOUR COMMENT