Best way to restore form values after a data view?

bgamrat

New Member
Our project allows the user to select a location field type is and equipment type and then sync to get all the corresponding items. Both fields are drop downs.

If, after selecting a location and equipment type, the user views the data, when they return to the form, the location and equipment type fields are empty.

What is the best way to preserve and present the values of the location and equipment type selectors in the form after the user goes to the data view and then returns to the form?
 

Dan Peluso

Member
Staff member
Hi,

If I am understanding correctly, your users are leaving the Entry form to return to the View Data form to see the records in a grid layout. Since the edit form does not retain previous values like y0u would need, there is not a way to do this as you describe. I think the best option would be to add an actual data grid to your Entry form which will then save you from having to leave the Entry form to review data.

The data grid can be added to the entry form via the Form Designer in TP Desktop.
 

bgamrat

New Member
How could I populate the data grid with the session data?

The objective is to provide a list of items which have not been scanned to the user, so after a sync, the data grid would be loaded with all the items in the selected location and category and each item would be removed after scan, leaving a list of times which were expected to be there, but hadn't been scanned.
 

OliverR

Member
There are a few ways you could go about doing this. I've attached a .tpe file of a very simple app that displays part numbers in a datagrid, filtered on a location dropdown. Part numbers that are scanned will disappear from the grid. I've also attached an import file to test this with; simply drop this in the \My Documents\TracerPlus9\Data\For_Import folder on your mobile device (assuming it's running Windows Mobile/CE). Obviously you would use Connect to sync the data to the device but for testing purposes a .txt import will do.

You can have a look at the datagrid settings to see how it works. I've also added some comments to some of the fields to explain what they do.

I've set the record submit options to update existing records based on part number. Part numbers that aren't on the device (ie. they weren't synced from the database) are NOT appended.

One thing I noticed, though, is that once you scan a non-existent part number (ie. one that's not shown in the grid), the app will stop working. When you leave the session and then re-enter it, the record count will be 0. You have to go into View Data mode, then go back into the Data Entry form and it will work again. I don't know if this is a bug. Maybe one of the devs can have a look at what causes this behavior.

I've only tested this on a WM Emulator, not on Android.
 

Attachments

bgamrat

New Member
I really appreciate this - and the comments you included in it. It ran nicely on my Windows device.

As you mentioned, it locks up if you scan a barcode that doesn't exist, so unfortunately, I've returned to have the session use the Data View to display any content and force the user to reset the location and category pulldown values if they leave the form.
 

bgamrat

New Member
I was able to achieve this using an ExecuteSQL form logic. The SQL read the value from the matching column in session data and set the field to that value.
 

Dan Peluso

Member
Staff member
Oliver,
Thanks for the user assist and sample attached project. I have added your project and comment to our issues list to see if we can reproduce and fix if appropriate.

Thanks again.
 
Top