cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HansHeintz
Post Patron
Post Patron

text field does not accept text value unless through intermediate variable

In this code

 

    UpdateContext({lGuid:GUID()})
    ;;UpdateContext({EhTest:ThisItem.Eenheid})
    ;;Collect(DitDierEvents;{
                             Omschrijving:ThisItem.Omschrijving
                            ;Aantal:ThisItem.Aantal
                            ;Eenheid:ThisItem.Eenheid
                            ;Memo:""
                            ;DierId:gDierRecord.identificatie_nummer_asiel
                            ;DocaDierId:gDierRecord.dier_id
                            ;EventDatum:Now()
                            ;EventtypeId:3
                            ;GUID:lGuid
                            })
;;Patch(
    [@DierEvent];
    Defaults([@DierEvent]);
    {
         UserEmail: User().Email
        ;EventDatum: Now()
        ;Memo:""
        ;Omschrijving:ThisItem.Omschrijving
        ;Aantal:Value(ThisItem.Aantal)
        ;LocatieId:If(!IsBlank(gKennel_asiel);gKennel_asiel.kennel_asiel_id;0)
        ;DocaDierId:gDierRecord.dier_id
        ;LocatieAsstring:If(!IsBlank(gKennel_asiel);gKennel_asiel.naam;"")
        ;DierId:gDierRecord.identificatie_nummer_asiel
        ;EventtypeId:3
        ;GUID:lGuid
        ;Eenheid:EhTest
    })
  

Creating a new record in the entity DierEvent Powerapps accepts EhTest in the last line, declared like this

;;UpdateContext({EhTest:ThisItem.Eenheid})

If I put ThisItem.Eenheid directly

 

;Eenheid:ThisItem.Eenheid

 

PA goes all red curlies on me while above the same value IS accepted in the collection DitDierEvents which is based upon the same table

I am trembling with excitement to get explained how this is logical 🙂

 

4 REPLIES 4
PowerAddict
Super User
Super User

Can you share the error message that you get?

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit Bhatia
https://thepoweraddict.com

It was a variable type mismatch error. But after closing the session and restarting it, it is gone. This variable, and the field in the entity, and the filed in the collection have never been anything but text.

I often have errors that will not go away until all is closed and opened again, while is the code is correct.

Rerunning on app start will not work.

And the error often does not occur from running the program but just from changing a line after which changing the line back does not correct the errors. So the simple undo button restores yout code to the point without errors but still the errors persist. And the line you change can have nothing to do with the code that goes wrong.

Makes debugging a nightmare because after wondering and searching what is wrong realising this might be the problem you loose another minute restarting the edit session.

So its working fine now?

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit Bhatia
https://www.thepoweraddict.com

Hey @HansHeintz 

 

Sometimes a lot of error occurs due to caching. It is a good practice to start a fresh session and always have the latest version of browser. If you feel a little inactivity or lag, you need to close the browser and open a fresh session. This solves the issue half of the time.

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (5,090)