Pre-populate Text Box in Display Form
Is it possible to pre-populate the texts boxes in a display form with data from a sql table?
I have a map that displays point data. When a point is clicked, a form opens with text boxes that allows a user to enter information, and submit that information into a sql table. I was wondering, if that data needs to be updated, is there a way to click on the point again and see the infomration that was previously entered already populated in the text boxes?
0
-
Yes. Execute a query before the Display Form. You may have to do this in a Try/Catch as if there is no record you might throw an error. If it returns a value, use the Runtime Modifications to put in the value. 0 -
Hi Tom, thanks for the response, I"ve added a query task before the Display Form, and used an Assign activity in Runtime Modifications with the following values... 0 -
Lisa, instead of just an Assign, create an IF statement where featureset.Count() > 0, for true, set your True value to Assign (form.Find(Of TextBoxFormItem)("TextBox1").DefaultText 0 -
Thank you so much Tom, that fixed the error, but I think I'm still missing something...When I run the workflow, the text box is still empty... 0 -
Lisa, put in an Alert with featureset.Features(0).Attributes("name").ToString() in it. Does it return anything were you know there is data? 0 -
Hi Tom, Would you suggest adding this Alert to the end of the Workflow? I'm very new to workflows so I dont know what best way to do this. When added to the end, I get this error again... 0 -
Put the Alert before the DisplayForm, you will need an IF statement just like in the Runtime Modification to test that there are features returned. But just to confirm, your FeatureSet has an attribute column "name" in it correct? From what I can see, your QueryTask is not returning any values. Should it? 0 -
Ok, I think that's the issue, the query task is querying the map service, whereas I need to be querying the sql table where the data is being stored from the SQL Non Query activity. That is where the 'name' attribute is coming from, from the sql table... 0 -
You should not use the SQL Non Query activity but the SQL Query activity. The first one will not return data. 0 -
Hi Nico, I dont think I explained myself very well...as seen from the screen shot above, I am using a SQL Non Query Activity towards the end of the workflow to add data to a sql table. So what I think I need to do is add a SQL query activity at the beginning of the workflow to query that sql table in order to pre-populate the text box with the data that has already been entered...I'm just not sure how to go about doing that... 0 -
The SQL Query activity returns a DataTable. You can use the DataTable to FeatureSet activity to convert it to a featureset. 0 -
Alright guys, I'm banging my head against a wall here...I"ve broken the workflow down to make it simpler...We are querying the sql table, converting the datatable to a feature set, and then have an alert that should convert the "name" attribute to a string... 0 -
sqlqueryresult.Rows.Item(0).Item("name").ToString()
is what I think you are after. No need for DataTabletoFeatureSet.0 -
0
-
Before the alert, insert an Assign and set it to sqlqueryresult.tablename = "TableName". Serialization issues can be annoying... 0 -
sqlqueryresult.TableName 0 -
YES! That was it! Thank you so much Tom! Like I said before, this learning curve has been steep! But baby steps are better then no steps! 0 -
You will periodically run into serialization issues. They can be frustrating at times. Glad it worked! 0
Please sign in to leave a comment.
Comments
18 comments