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
  • 0
    Certified Lead Developer
    in reply to Mike Schmitt

    Instead you can try this:

    a!localVariables(
      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.",
              {}
            )
          }
        )
      }
    )

    Note how this has been updated

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

    and presumably returns the value you actually wanted:

Children
No Data