web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Text Input Default Fun...
Power Apps
Unanswered

Text Input Default Function and Checkboxes for Collecting (Please Help, im desperate)

(0) ShareShare
ReportReport
Posted on by 301

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.

 

ShaneITAutomate_0-1620537538069.png

 

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..

\

Categories:
I have the same question (0)
  • TheRobRush Profile Picture
    11,128 Moderator on at

    have you tried creating a hidden timer that every (x) milliseconds expires and OnEnd parses your gallery for the newest item, and then generates the default value for storage (then if they turn it on mid work cycle the default value will have been keeping itself updated this entire time). You can set the timer to half a second or less, then on its expiration have it autorenew so this goes on as long as the app is open.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 326 Most Valuable Professional

#2
11manish Profile Picture

11manish 168

#3
sannavajjala87 Profile Picture

sannavajjala87 75 Super User 2026 Season 1

Last 30 days Overall leaderboard