Hi,
I have an app which a user inputs some text into a text input (Called TEXT_INPUT_OFSAMPLEID.Text) and then uses a buttons OnSubmit function.
I need the buttons OnSubmit function to do a few things,
1) Checks if a SampleID is already in one of two databases (SQLDataTable and TempData) and if it isnt then it patches, if it is Notify and Reset the TEXT_INPUT_OFSAMPLEID.Text to blank
2) If a context variable (varDoublePatchData) is equal to true, then patch it twice (see code), this context variable is controlled by a check box, if varDoublePatchData is equal to false then patch once.
The following code is what i have been working on for a few days, using the following it does work if i have a SampleID that is already in the system and it doesnt patch,
But now i have two problems one problem is it also notifies me if the TEXT_INPUT_OFSAMPLEID.Text is blank (every so often its supposed to be blank) and the second problem is it also notifies me if the SampleID is correct, it allows me to patch in both circumstances but i need it to not show that error.
I cant for the life of me work out where the error is? ive tried labeling it and dumbing it down for myself but i cant understand it.
Could someone look at my code and help me out?
Also CBSampleID is a checkbox i use to make the SampleID appear blank,
With(
{
withSAMIDSQL: LookUp(
SQLDataTable,
SampleID = TEXT_INPUT_OFSAMPLEID.Text
).SampleID,
withSAMIDSharepoint: LookUp(
TempData,
SampleID = TEXT_INPUT_OFSAMPLEID.Text
).SampleID
},
If(
IsBlank(withSAMIDSharepoint) && IsBlank(withSAMIDSQL) &&
If(varDoublePatchData=true,
Patch(TempData,
Defaults(TempData),
{
PID:DisplayPIDLabel.Text,
SampleID: If(CBSampleID.Value = true, "", TEXT_INPUT_OFSAMPLEID.Text),
TEXTCOLUMN: "1"
}
);
Patch(TempData,
Defaults(TempData),
{
PPID:DisplayPIDLabel.Text,
SampleID: If(CBSampleID.Value = true, "", TEXT_INPUT_OFSAMPLEID.Text),
TEXTCOLUMN: "2"
}
);UpdateContext({varMode : "TEMP"});
,
Patch(TempData,
Defaults(TempData),
{
PID:DisplayPIDLabel.Text,
SampleID: If(CBSampleID.Value = true, "", TEXT_INPUT_OFSAMPLEID),
TEXTCOLUMN: "1"
}
)
;UpdateContext({varMode : "Continue"})
,
Notify("THERE IS ALREADY AN SAMPLE WITH THAT EXACT SAMPLEID, PLEASE CHECK SAMPLEID AND TRY AGAIN");
TEXT_INPUT_OFSAMPLEID = "";
);
)