web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / cant get the right for...
Power Apps
Unanswered

cant get the right format for SQL upload

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

I have the following issue:

On the first screen you can enter how many buildings there are. On another screen you select the building and enter additional information. The dropdown looks like this: Distinct(Filter(Objekt;EAP_Exists);Anz_Gebaeude)

After adding addtional info the field is written into a collection as gebaeude_id. the value is numeric.

 

And now the issue: when I try to load it into my SQL database I get the error, that the field content is not matching the content of the database field. No matter if I set the database field to VARCHAR or INT I get the same issue.

Text(gebaeude_id) is not working. Value(gebaeude_id) neither.

Powerapps can be really annoying sometimes

Categories:
  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    HI @Anonymous 

     

    We can Patch SQL in Multiple Ways. The below code Creates or Update the record

     

    With(
     {
     item: LookUp(
     [@StudentTest],
     StudentID = Value(DataCardValue12.Text)
     )
     },
     If(
     IsBlank(item),
     Patch(
     [@StudentTest],
     {UserName: DataCardValue11.Text}
     ),
     Patch(
     [@StudentTest],
     LookUp(
     [@StudentTest],
     StudentID = BrowseGallery1.Selected.StudentID
     ),
     {UserName: DataCardValue11.Text}
     )
     )
    )

     

     

     

    Another approach to Update SQL, just passing ID without Lookup. In this Case StudentId is Primary Key

     

    Patch(
     [@StudentTest],
     {
     StudentID: BrowseGallery1.Selected.StudentID,
     UserName: DataCardValue11.Text
     }
    )

     

     

    Another Approach using Lookup (Not passing Primary key)

     

    Patch(
     [@StudentTest],
     LookUp(
     [@StudentTest],
     StudentID = BrowseGallery1.Selected.StudentID
     ),
     {UserName: DataCardValue11.Text}
    )

     

    • Please share with me
      • how you are loading to SQL
      • The data type for the Primary column and other columns that trying to create or update


    Thanks,
    Stalin - Learn To Illuminate

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hey Stalin 🙂

    With the following script, I create data in the database

    ForAll(Seilanlage;
    Patch('inspdeve.dim_seilanlagen';Defaults('inspdeve.dim_seilanlagen');
    
    {
     ID: 0;
     Objekt_ID: BV_Konto.Result;
    // Gebaeude_ID: Gebaeude_ID.Text; <-- NOT WORKING
     Gebaeudeteil_ID: Value(Gebaeudeteil_ID);
     Gebaeudeteil_Beschreibung: Text(GebaeudeteilBeschreibung.Value);
     Gebaeudeteil_Dachflaeche: Dachflaeche_ID; 
     Hersteller_ID: Text(Seilanlagen_Hersteller_ID);
     Produkt_ID: Seilanlagen_Produkt_ID.Text;
     Seriennummer:Seilanlagen_Seriennummer;
     Seil_nr: Text(Seilanlagen_Seil_Nr);
     Stuetze_von:Seilanlagen_Stütze_von;
     Stuetze_bis:Seilanlagen_Stütze_bis;
     Laenge:Seilanlagen_Länge;
     Ueberfahrbar:If(Seilanlagen_Überfahrbar = "true";"Y";"N");
     Herstellungsdatum:Seilanlagen_Herstellungsdatum;
     Komponenten_ID:Seilanlagen_Komponenten_ID.Text;
     Komponenten_Anz:Seilanlagen_Komponenten_Anzahl;
     Standort: Text(SeilanlagenStandortText);
    // Standort_foto_file: STANDORT;
    // Standort_foto_text: Text(STANDORT);
     gueltig_von: Today();
     gueltig_bis: Date(2099;12;31);
     DELETED: "N"
    
     }));;

     

    This field is causing issues: Gebaeude_ID.Text

    Gebaeude_ID.Text is genreated here:

     

    Collect(Seilanlage;{
     BV_Konto: BV_Kontonummer.Selected;
     Dachflaeche_ID:EAPDachflaeche_ID.Selected.Result;
     Gebaeudeteil_ID: LookUp('inspdeve.dim_gebaeudeteil'; gebaeudeteil_bezeichnung = SeilanlagenGebaeudeteilDropDown.SelectedText.Value;gebaeudeteil_ID);

     

    any more questions? Let me know 🙂

    Thanks in advanced and best regards from Germany

     

    Benny

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard