Skip to main content
sanjuktab2257
Inspiring
Sep 5, 2025 6:40 PM UTC
Question

Interface Date Field input customization

Within the Appian interface, the date field typically accepts dates separated by a forward slash ("/"). However, in our use case, there are scenarios where we need to support dates separated by a hyphen ("-") or a pipe ("|"). To accommodate this requirement, I’ve written the following piece of code

a!localVariables(
  local!onlyNumbers: cleanwith("1.22.1957", "1234567890"),
  local!length: len(local!onlyNumbers),
  if(local!length = 8,
  concat(left(local!onlyNumbers, 2), "/", mid(local!onlyNumbers, 3, 2), "/", right(local!onlyNumbers, 4)),
  if(local!length = 7,
  concat("0", left(local!onlyNumbers, 1), "/", mid(local!onlyNumbers, 2, 2), "/", right(local!onlyNumbers, 4)),
  null
  )
  ))

It seems that the Appian interface is not executing the logic as expected, and the error still persists.

3 replies

shubhama926776
Brainy
Sep 6, 2025 8:19 AM UTC

Try below sample interface code..

a!localVariables(
  local!dateInput: "",
  local!formattedDate: if(
    isnull(local!dateInput),
    null,
    a!localVariables(
      local!separator: if(
        find("-", local!dateInput) > 0, "-",
        if(find("|", local!dateInput) > 0, "|",
        if(find(".", local!dateInput) > 0, ".", "/"))
      ),
      local!parts: split(local!dateInput, local!separator),
      if(
        length(local!parts) = 3,
        concat(
          text(tointeger(local!parts[1]), "00"), "/",
          text(tointeger(local!parts[2]), "00"), "/",
          local!parts[3]
        ),
        "Invalid format"
      )
    )
  ),
  {
    a!textField(
      label: "Enter Date",
      placeholder: "MM-DD-YYYY or MM.DD.YYYY or MM|DD|YYYY",
      value: local!dateInput,
      saveInto: local!dateInput
    ),
    a!textField(
      label: "Formatted Date",
      value: local!formattedDate,
      readOnly: true
    )
  }
)

शुभम्
sanjuktab2257
Inspiring
Sep 8, 2025 1:51 PM UTC

Thank you, Shubham. I’d like to integrate the date values directly into the date design object, ideally with calendar selection functionality included.

harshas2775
Brainy
Sep 8, 2025 2:18 PM UTC

It is not possible to format the date field available OOTB in Appian Interface object. You need to either use textField like Shubham suggested so that user's enter dates with '-' or '|' . Otherwise have the users enter with default date field and then show with '-' or '|' when the field is read only for users. 

Happy to help. Even happier to optimize.