Home › Forum › Working with Tables › How to assign a seq number to each table record
Tagged: record seq
This topic contains 3 replies, has 0 voices, and was last updated by Winson 9 years, 4 months ago.
- AuthorPosts
- October 19, 2011 at 10:55 am #852
Hi, may i know how to assign a unique seq number to each record’s 1st column in table?
Thanks
October 19, 2011 at 4:55 pm #5894Each instance has a unique sequential number – the instance number. After the form is published the first time, the first instance starts at instance #1. You can simply use the instance #, or use a formula to build on it.
Remember that an instance # is not created until the instance has been submitted the first time. You may need to create a behavior on when form opens that sets a field (call it hidden instance # helper)with Special – Instance Number. Then use a simple branch to look at at that field. If the field value is less than 1 – submit and re-open the same instance. If it is = or greater than 1 go to an Exit behavior object.
October 20, 2011 at 1:44 am #5900Thanks Dennis for your reply. But if I want to assign seq # to column 1 in table in the same form (e.g. 1 for first row, 2 for 2nd, etc), how to do?
October 20, 2011 at 4:47 pm #5902Create a behavior to loop through the table.
Start with a Set Table Rows Object – Move to first row. Next use two Set Fields. Set a hidden helper field to 1. Set Field # column-current row to value in hidden helper. Set Table Rows Object – Move to next row. Simple Branch object – Was last command successful? If true use two Set Fields. Set the hidden helper field using a formula (hidden helper value + 1). Set Field # column current row to value in hidden helper. Then loop back to second Set Table Rows object (move to next row). If false go to Exit behavior object because you have reached the end of the table.
- AuthorPosts
You must be logged in to reply to this topic.