cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Trying to send database ID from a Powerapp back to an API

Afternoon all,

 

total newbie here, so please go easy - I did carry out some searches, and found some answers to other questions, but was struggling to find one for this.

 

I am totally new to Power Apps, but have been asked to create a powerapp to collect data on properties, and then write this back to a database.

 

A colleague who is more skilled in the DB and API side of things is assisting, and so far I have a front end set up.

He has configured the Azure DB, and I have setup the tables within.

 

Screen 1 asks for a postcode - you type this in, press a continue button, and the API checks the table we have with 60,000 properties in it, and then on screen 2 just offers you properties that share that same post code.

 

Under this we have 10 drop downs for various different categories, such as "Is there Gas in the propety?"

The drop down options are taken from seperate tables we have created within Azure, and an example set would be:

ID1: "Yes"

ID2: "No"

ID3: "Don't Know"

 

All of these tables have an ID column (As shown above, though this is not visible on the drop down), and what my colleague has asked is that I find a way to capture the ID from the db, and send this back as opposed to the text option that is chosen.

ie if they choose Yes, he wants ID1 to come back instead of 'Yes'.

 

I've also been struggling with how to get the data back at all, I had a look at collections, but don't think this is right, so thought that "Patch" would be the way to go.

 

This is what I put in, prior to the ID request being raised, but it doesn't like something about the syntax:

 

Patch([dbo].[assetsurveyresults], Defaults([dbo].[assetsurveyresults], (PropertyAddress: DD_addresschooser.selected.value, PropertyType: dd_propertytype.selected.value, gas: dd_gas.selected.value, heatsource: dd_heatsource.selected.value, fixedliftequip: dd_fixedliftequip.selected.value, liftequipoptions: listbox_liftequipoptions.selected.values, propertybalcony: dd_propertybalcony.selected.value, storeys: dd_storeys.selected.value, communallift: dd_communallift.selected.values, communalarea: dd_communalarea.selected.value, communalbalconies: dd_communalbalconies.selected.value))

 

I did try and put a Reset command on the end as well to clear the dropdown selection, but as this was causing issues, have moved them for the timebeing on to a 'Back' button I have created to go back to Page 1.

 

Thankyou in advance, and apologies if my terminology is verging on the useless.

 

Dan

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Anonymous
Not applicable

Re: Trying to send database ID from a Powerapp back to an API

If the dropdowns are coming from a table there should be other fields available than just .Value.

 

dd_gas.selected.value should read something like dd_gas.selected.ID?

 

Happy to jump on a call to unblock you if you need a few pointers.

View solution in original post

3 REPLIES 3
Highlighted
Anonymous
Not applicable

Re: Trying to send database ID from a Powerapp back to an API

If the dropdowns are coming from a table there should be other fields available than just .Value.

 

dd_gas.selected.value should read something like dd_gas.selected.ID?

 

Happy to jump on a call to unblock you if you need a few pointers.

View solution in original post

Highlighted
Regular Visitor

Re: Trying to send database ID from a Powerapp back to an API

Good morning Keith,

 

thankyou for your speedy reply 🙂

 

I'm going to give that a go this morning, and see what the result is.

 

I will update accordingly!

 

Thanks

 

Dan

Highlighted
Regular Visitor

Re: Trying to send database ID from a Powerapp back to an API

Thankyou Keith,

 

that did the job perfectly, apprecaite your time 🙂

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,873)