Count issue

Hi again,

Using MSSQL, I am trying to auto-generate the new ID for any record addition.
Using CRUD, I have generated the Add page which is fine. I have added a numeric field which returns the count of a related field in a different table (dropdown) and it works fine. That count is the one automatically generated for the paging of the dropdown. I get to see the correct value (using here ${getStatusesForStatusCount}).

If I do exactly the same to get a count of existing IDs in the table I want to add, numeric field remains empty.

Grateful if you could let me know what I do wrong.

Thank you

Fred

Hi @FredK_Trashmail,

In my opinion it will be better if your primary key is identity - in this case everything will automatic:

Ah! I started all this because I didn't figure out how to ensure auto-increment., id being the primary.

If I follow your suggestion, I just need to remove the Id field (or make it read-only) and I am good to go ?

Yep, you can remove the primary key field from the form in this case.

Great. Saves work. Thank you. Yet still don't understand why I couldn't get the Count

Turns out I can't save, even when removing the id field.

So back to the initial idea but will do it in Blazor. Easier for me

@FredK_Trashmail
Should just work if you added the identity column to the database. Did you refresh the data via data, Infer Schema ensuring the ID is selected after updating the database?

Being a beginner under time constrain and not too advanced, I started again with Blazor where finding my way around is easier. Almost done by the way. I just pass the count+1 as a parmeter from the page to the dialog which encapsulates the Add Page.

Anyway, thank you very much for your reply.

Cheers

1 Like