File Name Validation

Hi, everyone!

I have a problem, I'm designing an interface where you can attach a file but the file must have a nomenclature.

Example:

INVENTARIO (always) PRESENT MONTH PRESENT YEAR

INVENTARIO DIC 2023

But I tried with the follow code:

a!localVariables(
  local!var: {
    "ENERO",
    "FEB"
  },
  local!var2;
  {
    a!fileUploadField(
      saveInto: local!var2,
      value: local!var2,
      label: "File Upload",
      labelPosition: "ABOVE",
      validations: {
        if(
          fv!files.name = {"INVENTARIO" & upper(tostring(datetext(today(), "MMM"))) & upper(tostring(datetext(today(), "YYYY")))},
          {
          "Ingrese un documento nombrad correctamente."
        ),
      }
    )
  }
)

  • Add to Phrasebook
    • No word lists for English → Spanish...
    • Create a new word list...
  • Copy
  • Add to Phrasebook
    • No word lists for English → Spanish...
    • Create a new word list...
  • Copy

  Discussion posts and replies are publicly visible

Parents Reply
  • that's better.  i'm not sure i understand the issue though.  are you just saying the validation doesn't work?

    one thing I do notice is that you seem to have spaces in your preferred naming convention ("inventario dic 2023") but the string you're checking the filename against does not have any spaces built in.

    That is, this code:

    ""INVENTARIO" & upper(tostring(datetext(today(), "MMM"))) & upper(tostring(datetext(today(), "YYYY")))"

    would output "INVENTARIODEC2023", not "INVENTARIO DEC 2023".

Children