Hi,
I have an app where the user collects sample points i have it so the user can quickly put in some text in a text input field (ill call TEXTINPUT1) on a canvas app the type of text has the following format ZZ123456 and can be between ZZ000001 and ZZ999999 i have some simple background code with hidden labels so if the user uses the text and numbers ZZ999001 the next one added to TEXTINPUT1 field is ZZ999002 its so the user doesnt have to enter each sampleID manually and avoids mistakes in data. The user presses on a add button which collects and displays the data in a gallery for the user to patch it later to sharepoint.
My problem is the users now want to be able to have many empty sample numbers at the start of project and many empty sampleID anywhere before they patch (they want to save on sampling costs and know which points they want to sample and which ones they dont)
My first idea was to add a checkbox that says turn off sample id accuring,
However i cannot figure out the code to make it work.
Here is an example of what im trying to do.
i need the Textinput field to be blank until the user wishes to add a sample ID to the collection/gallery and the numbers accrue in the TEXTINPUT1 field, which i can achieve by the following two bits of code
TEXTINPUT1:DEFAULT
If(IsEmpty(Gallery1.AllItems),"", NextSampleID.Text)
And the following collect is a onsubmit on a button
Collect(colTEST, {Title:"Title",
SampleID:If(CHECKBOX1.Value = true, TEXTINPUT1.Text, "")})
However now when i turn the checkbox off the default value of the code becomes ZZ000001 because of the default code which looks at the hidden labels in the background to determine the next sample id name in the sequence (Its a few bits of string code to extract the numbers seperately and +1 and concat the text and numbers back together and that is the label called NextSampleID.Text
So i have two problems and no solutions i have come up with have worked, so If the user wants to turn the checkbox on in the middle of some sampling he will have to remove the ZZ000001 and manually reenter the next sampleID (bad it will lead to bad inputted user error data) and that also at the start of the app when the user will have many empty sample points the user will have to again remove the default ZZ000001 on the hidden labe; NextsampleID (Also bad because if its not blank they will forget and ill have to manually change it)
Could someone please help, ive been at this for weeks and its due tomorrow and i look incompetent.
Its got to the stage im thinking of calling in sick..
\

Report
All responses (
Answers (