Hello. In most spreadsheets you can click the corner and drag the cell to create sequential numbers and/or repeat text etc.
Is there a way to accomplish the same thing in Grist? And also, what about a formula that would accomplish this.
Thank You!
Hello. In most spreadsheets you can click the corner and drag the cell to create sequential numbers and/or repeat text etc.
Is there a way to accomplish the same thing in Grist? And also, what about a formula that would accomplish this.
Thank You!
Hi Chris!
This can be done using formulas. I created an example document that shows the options discussed below:
https://public.getgrist.com/1NenfgCTGrKv/Community-952
If you want the same value all the way down, youād have a formula just equal to that value. Letās say you have a column called āStateā and you want the same value all the way down to be Louisiana
. The formula would be: = "Louisiana"
. You can see this in the 'Same Value Formula` column in the example table.
If you want to set a default value for new records, you can do that with a trigger formula. Using the State example, letās say you want the default value to be Louisiana
when a new record is created because most of the time, the state will be that but not necessarily all the time, so you want the ability to update it. You can see an example of this in the āDefault Valueā column. It uses the same formula as before, = "Louisiana"
but now itās set as a trigger formula that only applies on new records.
When a record is created, it is assigned a unique Row ID. Using this in formulas allows you to create other unique numbers, like Order Number. To have sequential numbers that use the row ID, you can use the row ID in a simple formula. Check out āSequential Numbers using IDā. Here, the formula is = 1000 + $id
. So you have 1001
, 1002
, etc. I deleted Example 3
which was assigned Row ID = 3
so it jumps to 1004
so the numbers in this column remain unique to each record.
Let me know if you have any further questions!
Not OP, but going to jump in here since I was wondering about something similar relating to sequential numbering:
Iām trying to get a āsite codeā to generate automatically when a new site is made, with the site code being a two-character initial representing the city the site is in, followed by a two-digit number that is sequential based on how many other sites are in that city (e.g. when adding a new site in Townsville, which already has four sites, this new fifth siteās code would be TV05). Since the number doesnāt relate directly to the list of sites and instead relates to the number of sites in a particular city, Iām not sure I can use RowID for this.
Iāve tried the following (take the last site code and add one, basically):
ss_num = int(RIGHT(list(sorted(set((Sites.lookupRecords(City = $City).Site_Code))))[-1],2)) + 1
But then the system gets (kind of understandably) upset due to circular logic.
Any ideas on sequential numbering in a case like this?
Sequential numbers come up in a few situations, and with different requirements. I put together this example to illustrate a couple of the scenarios, with recipes for achieving them:
https://public.getgrist.com/jiNnH5ULBknm/Sequential-Numbers/m/fork
Had to like the post because you used āLouisianaā as an example
@OSAcadiana_Jobs - Check out Webinar 7 - Custom Widgets for more Louisiana references
lol, I canāt believe how few people use GetGrist- it should be millions more than it is. Needless to say, I was shocked to see a Louisiana reference in such a niche product. Great to know there are other fellow cajuns plowing away in this space!
Hi,
Iām also missing this. Really nice that you can come up with a formula. But if I have week numbers, or months, it is not that easy. Would just dragging the fields not be the ānormalā solution. Excel, Numbers, Google Sheets, LibreOffice, OpenOffice and every other spreadsheet tool since 1972 is using this technique. Creating a formula is way too hard for such a default type of behaviour. Donāt you think?
Best, Dirk