How do you update the python addin wizard code to write directly into access or pgdb? I have a combo box and need to have my users enter data into the combobox to write into the database. Can someone provide an example of how to accomplish this task?
To try and understand your Question, I have reviewed the Creating a Python Add-In Combo Box help page to remind me that ...
A combo box contains an editable field and a drop-down list. The user can select a value from the drop-down list, which appears at the user's request. If you make the combo box editable, the combo box will include an editable field into which the user can type a value. The scale combo box in ArcMap is a good example of a combo box.
If you are coming from a VB.NET background, then you may be thinking that a Python Add-In Combo Box can bind to an MS Access database as easily as a solution like these from another forum.
I have not had a requirement to try and work out the steps to do this using a Python Add-In Combo Box and ArcPy but am confident that Accessing data using cursors from the Data Access module of ArcPy (arcpy.da) will be required.
The example on the Creating a Python Add-In Combo Box help page does not include an editable field but that code could be:
- Run through to learn how to update the combo box with the list of layer names
- Adapted to learn how to update the combo box with a list of field values instead by using arcpy.da.SearchCursor
- Adapted more to include an editable field and work with arcpy.da.UpdateCursor and arcpy.da.InsertCursor
If there is existing sample code available for including an editable field in a Python Add-In Combo Box and using it to update a Personal Geodatabase feature class then I am not aware of it.