Skip to main content

Get Form Element Value Activity doesn't seem to work for Date-type elements

Comments

4 comments

  • Berend Veldkamp

    That is because the value of a datepicker is a numeric value and not a string. Notice that the same issue occurs for the various number form elements.

    The Alert activity takes only string values as parameter, while other types are invalid. Because the type of Get Form Element Value is defined as any, the workflow designer will not warn you, but typing =1234 will show The type 'number' is not valid for this input.

    To convert the value to string, use =$formElementValue1.value.toString() which will show e.g. 1727733600000. This is the number of milliseconds since Jan 1st 1970. If you want to show a human readable date, use =(new Date($formElementValue1.value)).toLocaleString().

    BTW the Log activity takes values of any kind, so =$formElementValue1.value will work there regardless of the type.

    1
  • Jack Charde

    Hey Berend,

    Thanks for that info and that totally makes sense. So, VertiGIS Studio Workflow expression windows will accept all or only some JavaScript built-in objects, like Date()? Just want to be aware for future usage.

    I'm new to this suite of software and just realized I could use the Log activity yesterday, and will definitely take advantage of it! 

    0
  • Berend Veldkamp

    Expressions accept some of JavaScript's built-in objects, e.g. Date is supported, but Esri objects can only be created using an appropriate activity. I'm not aware of a list of what's supported and what's not.

    Note that server-side workflows and workflows running in Go may behave differently than workflows running in Web, and may not support the same set of JavaScript features.

     

    1
  • Ken Lyon

    Jack Charde One way you could possibly trick it into converting a number to a string for the Alert activity would be to do something like this:

    ="" + $formElementValue1.value

    Or

    =$formElementValue1.value.toString()

    You'd need to make sure the value isn't undefined first of all, though. The first example would return “undefined” and the second would give an error.

    1

Please sign in to leave a comment.