cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AShep
Level: Powered On

Update textbox on screen visible

Hi All,

 

Problem Statement:

I have a screen (ListWells) which lists records as per search criteria. This screen also has a textbox which is used for searching records from this list of records which are rendered in a gallery(the records are shown from a collection). Whenever, I type anything in the textbox, matching records from the collection are shown in the gallery.

I have another screen (AddWells) where I add records which have a unique ID (this ID is typed in and not auto generated)

After the successful addition of record, it gets added to the collection (mentioned above) and the screen navigates to the list of records. (ListWells)

 

What I need to do it show the newly added record by default in the gallery so that the user does not have to search for it in the gallery again.

One way for me to do this is to auto populate the unique id in the textbox on first screen.

I did search the forums and tried to do it via setting a variable in UpdateContext and then marking the Default property of the Textbox to the variable. However this is not working at all.

 

Any suggestions?

 

Thanks,

Ashep

6 REPLIES 6
bsimon
Level: Powered On

Re: Update textbox on screen visible

Hi @AShep ,

I am not sure I quite understand your issue. The new record to the collection is not showing up ? When you navigate back to the screen that shows the collection in the gallery, did you try to refresh the datasource.

 

 

Super User
Super User

Re: Update textbox on screen visible

Yeah, agree with what @bsimon said, sounds like you are trying to filter by that unique ID, but you said:


"the records are shown from a collection"

Have you re-Collected the items in this collection from the DataSource before you filter the derived records by specifying the Unique ID in the textbox? 




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
AShep
Level: Powered On

Re: Update textbox on screen visible

Hi @bsimon ,

 

Actually, the data source is refreshed but what I need to do is that the unique ID of the newly added record should show up in the text input when the screen loads. This will automatically trigger the search in the collection and show up the newly added/edited record.

bsimon
Level: Powered On

Re: Update textbox on screen visible

Can you send some screens of how the ID triggers the search 


@AShep wrote:

Hi @bsimon ,

 

Actually, the data source is refreshed but what I need to do is that the unique ID of the newly added record should show up in the text input when the screen loads. This will automatically trigger the search in the collection and show up the newly added/edited record.


 

Community Support Team
Community Support Team

Re: Update textbox on screen visible

Hi @AShep ,

How do you add your new record into your collection? Using Patch function or SubmitForm function?

 

1. If you use Patch function to add a new record into your Collection, please take a try with the following workaround:

Set the OnSelect proeprty of the "Submit" button to following:

Set(
      CurrentSubmittedRecord,
      Patch(
                'YourCollection',
                 Defaults('YourCollection'),
                 {
                    IDColumn: IDTextBox.Text,
                    Column2: TextInputBox2.Text,
                    Column3: TextInputBox3.Text,
                    ...
                 }
      )
)

Note: If you use Collect function to add new record into your Collection, please consider modify above formula as below:

Set(
      CurrentSubmittedRecord,
      Last(
Collect( 'YourCollection', { IDColumn: IDTextBox.Text, Column2: TextInputBox2.Text, Column3: TextInputBox3.Text, ... } )
) )

then within your ListWells screen, set the Default property of the TextInput box to following:

CurrentSubmittedRecord.IDColumn

 

2. If you use SubmitForm function to add new record, please set the OnSuccess property of the Edit form (EditForm1) to following:

Set(
       CurrentSubmittedRecord,
       EditForm1.LastSubmit
)

then go to your ListWells screen, set the Default property of the TextInput box to following:

CurrentSubmittedRecord.IDColumn

 

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User
Super User

Re: Update textbox on screen visible

1. Change Form's OnSuccess property to:

Set(LastSubmitItem, FormName.LastSubmit);
//Set the default item for the search text box:
Set(DefaultSearchItem, LastSubmitItem.ID)

2.Make sure your Default for the TextBox is DefaultSearchItem (as set above)

 

3. Make sure your gallery Items is set to filter it by ID when there's text in the searchbox, something like:

 

//Check if there's anything typed in the box by determining length of text

If (Len(TextboxName.Text) >0,

    //Filter by that ID of last submitted item if text in box (can also add other search items here)
    Filter(
             DataSource,
             ID = TextBoxName.Text
    )
    ,
//Otherwise if length fo Text is zero then just do default Datasource or some other filtering     Datasource )

 

Now when you submit, it will collect that last submitted item (and its ID, oryou could do the "unique ID" manual field that you set, up to you), then filter by that using that last submitted item's value.

 

Any issues just paste your code here and let us have a dig through to see where the issue might be,

 

Cheers,

ManCat

 




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

Helpful resources

Announcements
thirdimage

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (6,852)