Testing for a file attachment

  • 0
  • 1
  • Question
  • Updated 3 weeks ago
  • Answered

I am using check box to trigger a notification and I have linked this check box to the test if the file has been attached.  I used  "" as the value to test if the attachment is available.  But it does not quite work.  So the question is if there is indeed an attachment, what does that constitute in terms of testing the field? 

Photo of Arshad Khwaja

Arshad Khwaja

  • 3,142 Points 3k badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,826 Points 50k badge 2x thumb
You should be able to use

ToText([My file attachment field]) =""

As a Boolean checkbox to be true if no file is attached.

Or

ToText([My file attachment field]) <> ""

As the opposite test
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,142 Points 3k badge 2x thumb
Thanks Mark.  I was originally trying to use form rule but after looking at your formula, I decided to create a fiormula check box field and the code as under:  

If(ToText([Drawing]) <>"", True, False)

Looks like it is working in this shape but there is no way I could use it as dynamic form rule?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,826 Points 50k badge 2x thumb
I have not tested recently, but I seem to recall that a file name cannot be used in a form rule, but if you make a formula field called [Drawing (text format)] with a formula of

ToText([Drawing])

then for sure that can be used in a form rule.

I ususally put fields which are used in form rules, on the form in a section hidden to all users, to be sure that the form rule "sees" the current value of the formula field as the form is edited.
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,142 Points 3k badge 2x thumb
Thanks a lot.  This is all good.
Photo of Mark

Mark

  • 10 Points
I have a similar request, but I'm not following the above steps to get my use case to work and was wondering if you could help me.  I want a form rule to show (and require) a checkbox field if a file has been attached.  I created a formula checkbox field called Photo Attest with the following formula If(ToText([FileUpload]) <>"", True, False)  How do I create the dynamic form rule?  I've tried but it won't let me pick the File Upload field if I chose the Photo Attest field as the "when" condition.  I'm just not getting the logic and the syntax of how this all comes together in dynamic form rules...I so wish they'd add if/then statements and multiple conditions in Dynamic Forms.  Thanks!
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,826 Points 50k badge 2x thumb
Make a field called file name with a formula of totext([file attachment field]). Then use that text field in your form rule.

As for multiple conditions, you can have AND and OR type conditions and multiple conditions.
Photo of Paul Vorster

Paul Vorster

  • 556 Points 500 badge 2x thumb
HI Mark, this worked great for me as well.  I have taken the process a step further, whereby we write a date/time when this upload took place.  The only challenge i am experiencing, is when the attachment is deleted, it doesn't take the previous date/time away.  I tried doing it with another form rule, but its not working...what am I doing wrong?


Photo of Isaac Sacolick

Isaac Sacolick

  • 70 Points
ToText([FileAttachment]) isn't changing when I select the file in [FileAttachment] so the dynamic rule isn't triggering. What am I missing?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,826 Points 50k badge 2x thumb
Is that field on the form? Quick Base is a bit lazy and does not recalculate Formula fields if they are not in the form. Try adding that field to the form. If that solves the problem you can still hide that field or a section called
Required for Form Rules

With a form rule that always hides that section, like some data entry field not equal 999999999
Photo of Isaac Sacolick

Isaac Sacolick

  • 70 Points
Yeah. It's on the form and it does recalculate when I put other things into the formula, but it doesn't seem to pickup the filename (or anything) from the FileAttachment field.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,826 Points 50k badge 2x thumb
Sorry, no ideas.

This conversation is no longer open for comments or replies.