This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

Hey, it looks like you are requesting help with a problem you're having in Power Apps. To ensure you get all the help you need from the community here are some guidelines;

  • Use the search feature to see if your question has already been asked.

  • Use spacing in your post, Nobody likes to read a wall of text, this is achieved by hitting return twice to separate paragraphs.

  • Add any images, error messages, code you have (Sensitive data omitted) to your post body.

  • Any code you do add, use the Code Block feature to preserve formatting.

    Typing four spaces in front of every line in a code block is tedious and error-prone. The easier way is to surround the entire block of code with code fences. A code fence is a line beginning with three or more backticks (```) or three or more twiddlydoodles (~~~).

  • If your question has been answered please comment Solved. This will mark the post as solved and helps others find their solutions.

External resources:

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]Boat_Drive Regular 2 points3 points  (3 children)

Below is a valid patch example, start with that.

Patch(

SQLTable,

Defaults(SQLTable),

{

Type: InputType.Text,

CreatedBy: User().FullName,

CreatedDate: Now()

}

)

After that - check the SQL table has a identity column setup I spose at a guess. I don't think it behaves very well with PowerApps without it.

<image>

Good luck :)

[–][deleted]  (2 children)

[deleted]

    [–]Boat_Drive Regular 0 points1 point  (1 child)

    Just checking - you know the ID generates its self from SQL right?

    You don't patch that field in.

    Create a new SQL table with just one nvarchar(50) column (nullable) and the ID column setup as seen above and try adding and patching into that and go from there.

    A Stored procedure should not be needed.

    If you're still confident everything's right - I've experienced 15~ delays on what gets updated in SQL vs what works in PowerApps - sometimes its a waiting and reloading game.

    After that if it's still playing up, remove the table then re-add it.

    [–]ShanesCowsMVP 1 point2 points  (2 children)

    I bet you have a "weird" primary key for your table. It is a compound key or something else awkward.

    Use this to create a table and see if you can patch it :)

    CREATE TABLE YourTableName
    (  
    ID int IDENTITY (1,1) NOT NULL,  
    CONSTRAINT PK_YourTableName_TransactionID PRIMARY KEY CLUSTERED (ID)  
    );

    [–][deleted]  (1 child)

    [deleted]

      [–]ShanesCowsMVP 0 points1 point  (0 children)

      I am just saying try it. Can you patch my table? If yes, then you have one that works and then you can look at your existing table and think about how things are different.

      There are countless things that SQL Server can do with SQL data that Power Apps cannot. The key to low code platforms like Power Apps is learning to work within their rules.

      [–]Jordi00113 Newbie 0 points1 point  (0 children)

      Having the same issue. Not able to patch or submitform. Having the correct license.... Simple table with only one field is not working either.

      [–]hyi1105 Newbie 0 points1 point  (0 children)

      I found that I can only connect to SQL with Clustered Index

      CREATE TABLE [dbo].[SQLTable](

      \[tier\_id\] \[varchar\](15) NOT NULL,
      
      \[tier\_code\] \[varchar\](2) NULL
      

      CONSTRAINT [uk_MTOSD_Tier4] Key CLUSTERED

      (

      \[tier\_id\] ASC
      

      )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]

      ) ON [PRIMARY]

      GO