Ask Your Question
2

How can I use PowerApps to generate an automatically increasing ID in Postgres?

asked 2022-09-23 11:00:00 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2022-10-30 23:00:00 +0000

woof gravatar image

PowerApps cannot generate an automatically increasing ID in Postgres itself. However, you can create a sequence in Postgres to generate an automatically increasing ID and use this sequence in your PowerApps application.

To create a sequence in Postgres:

  1. Open your Postgres client and connect to your database.
  2. Run the following SQL command to create a sequence:
CREATE SEQUENCE my_sequence
INCREMENT BY 1
START WITH 1

This creates a sequence named my_sequence that increments by 1 and starts with 1.

  1. Use the nextval function to get the next value from the sequence. For example, to get the next value from my_sequence, use the following SQL command:
SELECT nextval('my_sequence');

This will return the next value from the sequence.

  1. In your PowerApps application, connect to your Postgres database using the PostgreSQL connector.
  2. Create a new data source for the my_sequence sequence by selecting the SQL Server option and entering the appropriate connection details and SQL syntax to generate a sequence for your specific datasource.
  3. Add a new gallery or form to your app and reference this datasource to display and manipulate the automatically generated ID.

Now, when you create a new record in your app, you can use the nextval function from the Postgres sequence to generate an automatically increasing ID for that record.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-09-23 11:00:00 +0000

Seen: 12 times

Last updated: Oct 30 '22