DateTime field issue, updated value is not displaying

Hi Everyone,

I have two fields dropdown and datetime. Date and Time field value will be updating when drop down value is changing and user can update the date and time value if require. This works fine. 

But if you remove either date or time value then change the value in drop down then updated value is not displaying in the field but value in the variable is updated. This issue comes only when user removes one of the value in the date-time field. 

Please let me know if u could find any solutions for this.

Code is as follows,

load(
local!dropDownValue,
local!dateAndTimeValue,
{
a!dropdownField(
choiceLabels: {
"Normal",
"Urgent",
"Medium"
},
choiceValues: {
"Normal",
"Urgent",
"Medium"
},
value: local!dropDownValue,
saveInto: {
local!dropDownValue,
if(
rule!APN_isBlank(
local!dropDownValue
),
a!save(
local!dateAndTimeValue,
null
),
if(
local!dropDownValue = "Normal",
a!save(
local!dateAndTimeValue,
now() + 30
),
{
a!save(
local!dateAndTimeValue,
now() + 10
)
}
)
)
},
placeholderLabel: "--Select--",
label: "Dropdown"
),
a!dateTimeField(
label: "Date Time",
value: local!dateAndTimeValue,
saveInto: local!dateAndTimeValue
),
a!textField(
label: "saved date value",
value: local!dateAndTimeValue
),

}
)

Thanks,

Bhargavi P.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    I was able to reproduce what you're talking about, but I'm not sure it's a bug exactly.  From my rough understanding, the DateTime field goes into a special "in progress" state when only one of the two values has been filled out -- i.e. date OR time but not both (as in your example) -- meaning, i guess, that it is not executing a saveInto and also is not displaying whatever value is displayed in its "value" parameter (since it would be null until both sides are filled out the first time).

  • Thanks Mike for the reply, The issue is that when there is value in the DateTime field and then i have emptied either date or time , then i change the value in the drop down where i will be setting the value for DateTime field to other time which DateTime Field will not be displaying. If you the image the variable value for DateTime field is updated but its not showing up in the actual field. 

  • 0
    Certified Lead Developer
    in reply to bhargavip0001

    Yes - this is the behavior I was explaining in my comment above.

    Are you worried about a user clearing out just one side of the date/time field?  If so, then the best solution would probably be to add a control allowing the user to "clear" the date/time value so that they're not tempted to clear one side at a time, possibly only clearing out one side before changing the dropdown.

    Edited to add: using side by side layout, plus rich text icons with dynamic coloring and links, you can make a "clear" icon that works pretty seamlessly - example below:

    load(
      local!dropDownValue,
      local!dateAndTimeValue,
      {
        a!dropdownField(
          choiceLabels: {
            "Normal",
            "Urgent",
            "Medium"
          },
          choiceValues: {
            "Normal",
            "Urgent",
            "Medium"
          },
          value: local!dropDownValue,
          saveInto: {
            local!dropDownValue,
            if(
              rule!APN_isBlank( local!dropDownValue ),
              a!save(
                local!dateAndTimeValue,
                null
              ),
              if(
                local!dropDownValue = "Normal",
                a!save(
                  local!dateAndTimeValue,
                  now() + 30
                ),
                {
                  a!save(
                    local!dateAndTimeValue,
                    now() + 10
                  )
                }
              )
            )
          },
          placeholderLabel: "--Select--",
          label: "Dropdown"
        ),
        
        a!sideBySideLayout(
          alignVertical: "BOTTOM",
          items: {
            a!sideBySideItem(
              width: "MINIMIZE",
              item: a!dateTimeField(
                label: "Date Time",
                value: local!dateAndTimeValue,
                saveInto: local!dateAndTimeValue
              ),
            ),
            
            a!sideBySideItem(
              width: "MINIMIZE",
              item: a!richTextDisplayField(
                value: a!richTextItem(
                  text: a!richTextIcon(
                    icon: "REMOVE",
                    caption: "Clear Date/Time",
                    size: "LARGE",
                    color: if(rule!APN_isBlank(local!dateAndTimeValue),"SECONDARY", "NEGATIVE")
                  ),
                  link: a!dynamicLink(
                    showWhen: not(rule!APN_isBlank(local!dateAndTimeValue)),
                    saveInto: {
                      a!save(
                        local!dateAndTimeValue,
                        null()
                      )
                    }
                  ),
                  linkStyle: "STANDALONE"
                )
              )
            )
          }
        ),
        a!textField(
          label: "saved date value",
          value: local!dateAndTimeValue
        )
      }
    )

  • Yeah this is good idea, may be i can follow this but I can't restrict the user to not to clear date or time alone isn't it ? Actually it looks like value is not updated but it is updated with different value shows inconsistency to the user may be.   

  • 0
    Certified Lead Developer
    in reply to bhargavip0001
    but I can't restrict the user to not to clear date or time alone

    No, we have no control over this.

    Basically the way you should think of it is: the date/time field only executes its save once both sides have a value entered (either a value provided for both sides, or both sides are cleared).  As I said, we have no control over this and honestly, I don't think there is much Appian could do to fix this, since the expected behavior has to be that a user has to enter values on both sides before the component attempts to do a save, since otherwise it would be saving an incorrect value when only one side has been populated.

  • You are right but at-least they should handle to show the updated data in the variable isn't it ? 

  • 0
    Certified Lead Developer
    in reply to bhargavip0001

    We can't know exactly what's going on in the background within Appian, but I made my best guess as to why not in my original comment - in short, when only half of the date field is filled in, it probably ignores everything else assuming that a user is still planning to fill in the other half eventually.

Reply Children
No Data