MS SQL identity columns

Sorry, have searched docs but can’t find an answer to this! Why is it not possible to use an MS SQL identity column as the unique row id that Glide needs? I would have rows being added outside of Glide and therefore a Glide only solution would not be ideal. Thanks

1 Like

I believe we have a call scheduled for tomorrow but to answer the question (so others see it) here is the reason it isn’t working.

Glide requires a unique id that is a fixed value from SQL. MS SQL is basically doing a generated value which is not recognized as a proper ID value. The workaround is to just add a sequencing column to SQL which we can now use at the unique ID for that row.

2 Likes

Hi Darren,

Thank you, I’ve added a sequence construct and a new field to store that sequence number and also added that table to Glide selecting that field as the unique row id. I now have a number of SQL tables listed in Glide. Then I added an extra field to the users table which will allow me to relate the users table to my own expenses table (so that only records for the logged in user will be displayed). Next I added extra columns to my main expenses table to specify the relationship to other tables (jobs, expense_type, users). Now I want to start with a screen that actually shows a summary of expenses based on their status which I would normally use an aggregate query for. My issues so far are this:

  1. Writing a bespoke SQL query to get the aggregate values is no problem but how can I include criteria to limit the results to those for the logged-in user? Can I refer to a current record in the users table? I’ve added a field called employee_login to Glide’s user table which matches a field employee_login in my expenses table and I’ve edited the users table row which has my details and added the employee login value which just happens to be “MARTIN”. Right now I’ve hard coded my employee_login value in the SQL.

  2. I have created this first screen using a data grid and this looks fine but I can’t see how to allow the user to select a row which would lead to another screen passing the unique row value which would then display expenses with the specific status? Strangely at the bottom of this first screen it has “+ users” at the bottom right and the name of the current page at the bottom left. I have turned off editing/deleting since an aggregate of course. In addition, how it is possible to format a value as a number with decimal places (but not with any currency symbol) and right align? Could a total row be added?

Thanks,