Hi all,
I can't seem to Patch more than two data sources in a single button on select. Is it becuase of my If function?
I've tried writting it a few times in different ways, but each time it only ever patches to my first two data sources. Such as using only one If statement and putting all three true patch values in there, but again, no luck.
If(
Or(
DocumentTypeSelector.SelectedText.Value = "02 - Assembly / Drawing",
DocumentTypeSelector.SelectedText.Value = "04 - Part / Drawing"
),
Patch(
IERMasterDocuments,
Defaults(IERMasterDocuments),
{
PartNumber: GeneratedPN.Text,
CreatedOn: CreatedOn1.Text,
CreatedBy: CreatedBy1.Text,
DocumentType: DocumentTypeSelector.Selected.Result,
System: SystemTypePrefix.Text,
Project: ProjectTypeSelector.Selected.Result,
ProjectUniqueNumber: ProjectUnique2.Text,
Release: IssueInput.Text,
'Status (crec2_status)': StatusInput.Text,
Description: DescriptionInput.Text,
Notes: NotesInput.Text,
Barcode: GeneratedPN.Text,
Location: LocationInput.Text,
StockLevel: Value(QuantityInput.Text),
Cost: Value(CostInput.Text),
VendorCost: Value(VendorCostEachInput.Text)
}
);,
false
);
If(
Or(
DocumentTypeSelector.SelectedText.Value = "02 - Assembly / Drawing",
DocumentTypeSelector.SelectedText.Value = "04 - Part / Drawing"
),
Patch(
IERStockHistories,
Defaults(IERStockHistories),
{
Title:"New Stock",
PartNumber:GeneratedPN.Text,
Quantity:Value(QuantityInput.Text),
CostEach:Value(CostInput.Text),
CostTotal:Value(CostInput*QuantityInput.Text),
EffectiveCost:Value(CostInput*QuantityInput.Text),
TakenBy:User().FullName,
Date:Text(Now(),"dd-mmm-yy"),
Reason:"Restocked"
}
);,
false
);
If(
Or(
DocumentTypeSelector.SelectedText.Value = "02 - Assembly / Drawing",
DocumentTypeSelector.SelectedText.Value = "04 - Part / Drawing"
),
Patch(
IERPartsVendors,
Defaults(IERPartsVendors),
{
PartNumber: GeneratedPN.Text,
Vendor: VendorPicker.Selected.Result,
VendorPN: VendorPNInput.Text,
VendorDescription: VendorDesInput.Text,
VendorCost: Value(VendorCostInput.Text),
VendorQty: Value(VendorQtyInput.Text),
VendorCostEach: Value(VendorCostEachInput.Text)
}
);,
false
);
If(
Or(
DocumentTypeSelector.SelectedText.Value = "02 - Assembly / Drawing",
DocumentTypeSelector.SelectedText.Value = "04 - Part / Drawing"
),
false,
Patch(
IERMasterDocuments,
Defaults(IERMasterDocuments),
{
PartNumber: GeneratedPN.Text,
CreatedOn: CreatedOn1.Text,
CreatedBy: CreatedBy1.Text,
DocumentType: DocumentTypeSelector.Selected.Result,
System: SystemTypePrefix.Text,
Project: ProjectTypeSelector.Selected.Result,
ProjectUniqueNumber: ProjectUnique2.Text,
Release: IssueInput.Text,
'Status (crec2_status)': StatusInput.Text,
Description: DescriptionInput.Text,
Notes: NotesInput.Text,
Barcode: GeneratedPN.Text
}
);
);
Patch(
IERMasterHistories,
Defaults(IERMasterHistories),
{
PartNumber:GeneratedPN.Text,
Change:"Initial Creation",
ChangeBy:User().FullName,
ChangeOn:Text(Now(),"dd-mmm-yy")
}
);
Set(
varInfoMode,
"0"
);
Reset(DocumentTypeSelector);
Reset('01_SystemTypeSelector');
Reset('02_SystemTypeSelector');
Reset('05_SystemTypeSelector');
Reset('07_SystemTypeSelector');
Reset('04_SystemTypeSelector');
Reset('10_SystemTypeSelector');
Reset(ProjectTypeSelector);
Reset(DescriptionInput);
Reset(NotesInput);
Reset(CreatedOn1);
Reset(LocationInput);
Reset(QuantityInput);
Reset(CostInput);
Reset(VendorPicker);
Reset(VendorPNInput);
Reset(VendorDesInput);
Reset(VendorCostInput);
Reset(VendorQtyInput);
UpdateContext({Checkbox2Value: false});
Navigate(MainScreen)
Can some one please point out why I can't get this to work? I've been trying to figure out a solution for two days now!
Thanks,
Luke.