Skip to main content
Question

How do a set a formula text field to require a unique value?

  • October 4, 2013
  • 0 replies
  • 315 views

How do a set a formula text field to require a unique value?
This topic has been closed for replies.

Forum|alt.badge.img+6
  • Quickbase Alumni
  • October 4, 2013
Click the checkbox called Unique in the field's Properties :)

  • Quickbase Alumni
  • August 29, 2014
I tried this and it said "This formula is incompatible with this field being marked unique" - what are the compatibly requirements?

I don't know what all the limitations are. I do know that you cannot use the [record id#], a lookup field, .the formula user() field, the now() function or the today(0 function.

Forum|alt.badge.img+5
  • Quickbase Alumni
  • February 14, 2015
Does anyone have a list of what the limitations are? Somewhat frustrating that it keeps saying that a formula is incompatible, but not what is making it so.

See my answer above. I would also add User().

It makes sense really. You can't use a lookup field in a Unique formula since a change in the lookup field could cause many records to go Non Unique.

Note, however, that the typical field [Related Parent] is quite ok to use.

  • Quickbase Alumni
  • March 15, 2017
I'm having a similar issue in my app. I have a formula text field called File Name that I marked "must be unique" which prevents Users from uploading duplicate file attachments into the Documents table. However after selecting this Unique value checkbox, I'm still able to upload documents with the same name. Thoughts? 

TateForgey
Forum|alt.badge.img+7
  • Quickbase Alumni
  • June 15, 2018
BUMP! 

Just checking on this since I am looking for the best way to do this exact thing (prevent users from uploading an attachment with a name that already exists.)  Any ideas?  I too tried to make a formula text field unique, but that doesn't seem to work.

you could try this

make a formula which calcuates the name of the file.

ToText([my file attachment field]) and then make a form rule to copy that to a text field all the time.

ie when Formula of file attachment field <> text value of file attachment field change the text to the formula and uncheck the checkbox so the rule always fires.

Then mark the text field unique.

TateForgey
Forum|alt.badge.img+7
  • Quickbase Alumni
  • June 18, 2018
This sounds like a great way to get around a formula field not being able to be set to be unique, but I'm having some issues with sequencing.  I've got the formula field and I've got the dynamic form rule, but no matter what I seem to use for the trigger the form rule doesn't fire.  It seems like the formula field is executing after the dynamic rule and nothing gets copied over.  If I were to edit that record it comes in correctly since it is already there.

Any way to fire the action after the form rule executes?

TateForgey
Forum|alt.badge.img+7
  • Quickbase Alumni
  • June 18, 2018
Actually - we may be able to get rid of the inbetween step of the formula field altogether. 

Even though it is a little nonsensical I modified the form rule to copy the attachment directly to the text field.  This did produce a value that did appropriately throw the non-unique error when I attempted to attach the same file.  The question is whether the format that was populated in the text field is going to stay consistent.  So, I have a new question!

Will the a copy of an attachment to a text field always come in as "C:\fakepath\YOUR-FILE-NAME"?

I did a test and now I see that the formula text field does not calculate until the record is actually saved.  So now I'm not sure what to suggest.

TateForgey
Forum|alt.badge.img+7
  • Quickbase Alumni
  • June 18, 2018
Just tested with a different user, different file location, same file and did get the error, as you would expect, with the "fakepath" text.  So, as long as QB doesn't change the way that processes I'm going to call this solved!

OK!