What does it mean that my form version number is not lexically greater?

This article will help you understand how to resolve the following error, which you might encounter when deployed changes to a form design:

Lexically_greater_error_message.png

Form version is not lexically greater than existing form version (2003251314). Update the form version and resubmit.

Why am I getting this error?

The SurveyCTO platform tracks updates you make across deployed form versions using a numeric form version system. The numbering system is based on the date and time, down to the minute. For example, 21 January 2020, 20:02 translates to version number 2001212002 (YYMMDDhhmm format). This is based on the logic of this spreadsheet formula for calculating form version numbers:

=TEXT(YEAR(NOW())-2000, "00") & TEXT(MONTH(NOW()), "00") & TEXT(DAY(NOW()), "00") & TEXT(HOUR(NOW()), "00") & TEXT(MINUTE(NOW()), "00")

Even though you might be working in the online form designer, the same logic applies.

First fix: Just wait a minute

If your form design uses the above version number formula, all you need to do is wait a minute, save your form design, and attempt to deploy your changes again. If that doesn't help, continue with this guide.

Saving and making changes to the design should advance the automatic form version number.

I'm still getting this error after waiting a minute - what do I do?

What you need to do depends on whether you're working in the online form designer, or in a spreadsheet template.

Working in the online form designer

There are two considerations that come into play when designing forms online:

Working with colleagues across different time zones

Seeing as SurveyCTO's default form version numbering is based on the current date and time, working across time zones can cause issues. If you are based in New York (UTC -04:00), and you are collaborating with a colleague based in Nairobi (UTC +03:00), you have a seven hour time difference. That means when your colleague in Nairobi saves a change at 4:00PM local time, and if you start work at 9:00AM (4:00PM in Nairobi), you won't be able to save changes until 4:01PM in your local time on the same date.

However, if you're collaborating with colleagues in the same time zone, this shouldn't be a problem.

See the tips section below for useful advice, in particular the advice on using Google Sheets for collaborative form design.

If you're working on a form design that was deployed from a spreadsheet

Even if you're working in the online form designer, if your form design was deployed on your server from a spreadsheet form definition, you might be experiencing one of the problems discussed below in the rest of this article. However, you can probably fix this issue relatively quickly by double-checking that you're using the automatic version number formula:

  1. Open the form design in the online form designer (click on Edit under its title on the Design tab).
  2. Click on Form settings in the upper-left.
  3. Click on Edit form settings in the lower-right of the panel that opens.
  4. See the third option down, form_version, which should be set to Automatic (based on formula). Even if it is, click on Edit to the right.
  5. To be doubly sure, you can replace whatever is there with the above formula.
  6. Click on Save in the upper-right to confirm your changes.

Wait a minute, and try to save your form again after these steps.

Working in form definition spreadsheets using manual version numbers

Spreadsheet form designs should use the same automatic version numbering formula above, and if you do, you should have no problems so long as you're not collaborating over more than one time zone.

See the tips section below for useful advice, particularly if you're collaborating across time zones.

While you have the option of using manual version numbering, we do not recommend it, as it is very error prone, given misunderstandings around what "lexically greater" means (see below). As above, the quickest and best way to eliminate these errors is to swap your manual version number for the above version numbering formula.

Lexically greater

What does it mean to be lexically greater? Lexically greater is different from numerically superior. In numerical comparisons 10 is greater than 9, but not so in lexical comparisons. This is because lexical comparison involves comparing two strings (the old form version, with the new form version), character by character, from the left. So, while the number 10 is numerically superior to number 9, this is not the case with a lexical comparison:

String position 1 String position 2
9 -
1 0
9 is greater than 1, which is the end of the story. It doesn't matter in lexical comparisons that there's 0 after 1. Will not compare blank and 0, since it has already been determined with the first digits that 9 is greater than 1.

So, in lexical comparison, version 9 is greater than version 10.

Here's another example, with actual form version numbers, generated by the formula:

Form version Version number Corresponding date
Deployed form 2001212002 21 January 2020, 20:02
Form update 2001211001 21 January 2020, 10:01

Here you can see that the deployed form version number is more advanced than the update, so the update cannot be deployed. Starting from the left, the numbers match until you get to the numbers in bold. There, you can see that for the seventh number, the updated form version has a 1, and the deployed version has a 2, so the form update cannot be applied, since the form version is not lexically greater.

How to use manual form version numbers

Many form version numbers are possible to use, but you need to plan for the future. If the first version number is 1, you can update the form a further eight times before running into the "lexically" greater error. Eight form versions may not be enough!

So, if you really don't want to use automatic form version numbering, start with something like version 1001 or 1111 as your first manual form version number, where it starts with the low-numbers 1 and 0. Keep in mind that the length of your ID will determine the maximum number of possible form versions. More is always better, which is why we use the automated formula.

Tips and workarounds

Here are a few bits of advice which may be useful, depending on your situation:

You are collaborating with colleagues in the spreadsheet template

Switch to Google Sheets, if you're not already using it. Google Sheets saves automatically, and everyone who's working with you will always have the latest version when they're online. Google Sheets can also be anchored to a specific time zone.

With a Google Sheet open, open the File menu in the upper-left, then Spreadsheet settings. See the Locale setting, which you should set to the more advanced time zone amongst your collaborators. For example, if you are based in Nairobi, and if your colleagues are in Boston, and Tokyo, pick Tokyo, as it is the time zone furthest into the future.

You may still have to wait a minute before being able to update a form on the server, but you'll never be blocked extendedly.

You've collected data and need to make changes

You can modify the version formula by adding a day. Either in the online designer (instructions above), or on the settings sheet in the spreadsheet template, add a day in the following way to the above formula (see the '+1' in red):

=TEXT(YEAR(NOW())-2000, "00") & TEXT(MONTH(NOW()), "00") & TEXT(DAY(NOW())+1, "00") & TEXT(HOUR(NOW()), "00") & TEXT(MINUTE(NOW()), "00")

Save your changes, and try again to deploy your new form version.

You're collaborating across times zones, but you haven't collected any data

Let's say that your colleague in a more advanced time zone has finished work, and you wish to continue working, deploying the new form version to the server so that you can test your changes. You also haven't collected any data yet. Another way to deploy an update is to delete the deployed form version, and then redeploy the new version.

Be warned though: this is not at all how you should manage form updates on SurveyCTO. Read more on the subject here. However, it is of less consequence if you haven't collected any data.

Be certain that you have a copy of the latest deployed form version before doing this. Go to the Design tab, click on Download under the form's title, then pick Form files. You can download the deployed version and other historical versions from here (which is why deleting forms between updates is generally a very bad idea).

Getting support

If you're still struggling with this, please request assistance. Paid and trial users can start a support ticket on the Support Center by clicking the Submit support request link. Alternatively, post a question in the user forum.

Do you have thoughts on this support article? We'd love to hear them! Feel free to fill out this feedback form.

0 Comments

Please sign in to leave a comment.