Data type to allow for image or file type

I am building a simple expense tracker. As part of the expense entry form, I have a field for uploading a receipt. I currently have the field set to use an image datatype. But I would like the field to also allow the user to choose a non image file instead if the receipt is in pdf format. From reading the documentation, it seemed that this would only work if I seperated them into 2 fields. โ€ฆone for images and one for files. From a user experience, this is less than ideal. Any suggestions? Thanks in advance.

1 1 205
1 REPLY 1

Hello @leisterbrau, you could add an auxiliary enum field in your data source to use as a button for choosing the type of the file to upload, the options being โ€œPDFโ€ or โ€œImageโ€, then using the show_if() parameters in your image and file columns you can insert an expression that would only show the one that is currently selected, for example:

For your show_ifs() for your PDF and Image columns respectively:

[enumColumn]="PDF"

[enumColumn]="Image"

For your editable_if() in your [enumColumn]

AND(ISBLANK([fileColumn]),ISBLANK([imageColumn]))

This last one is to avoid the possibility that an user, for example, selects the โ€œPDFโ€ type, uploads a file in its respective column, then switches to โ€œImageโ€ and does the same, as soon as they upload a file or image they wonโ€™t be able to change the type, unless they erase it from the form.

Top Labels in this Space