Function to find the data type of a constant?

Is there a function which can give the data type of a constant? The function "getcontentdetailsbyuuid" doesn't provide that information.

 

Use Case:

I want to build a UI for the business users to manage few constants. The UI should dynamically display the type of field based on the data type of the constant. example: Display date field for a constant with "date" as the data type

  Discussion posts and replies are publicly visible

Parents
  • Will this work for you?

    fn!typeName(fn!typeOf(cons!YOUR_CONSTANT)) 

  • 0
    A Score Level 1
    in reply to Robert Shankin

    Is there a way to do this with a list of type "Content Constant"?

    Basically I have a list of data about constants and I want to get the type of each. I tried fn!typeOf("cons!" & fv!item) where fv!item is the constant's name. That just returned text for everything since it's technically text.  I tried fn!typeOf(fv!item) where fv!item is the constant itself and it returns "Content Constantfor everything since they are constants (instead of telling the type of data the constant holds).

    I am getting the constants with the Content Tools plugin and this code:

    local!constants: a!flatten(
      a!forEach(
        items: ri!constantFolders,
        expression: fn!getconstantsfromfolder(
          rootFolder: fv!item,
          recursiveSearch: true
        )
      )
    )

    Thank you!

Reply
  • 0
    A Score Level 1
    in reply to Robert Shankin

    Is there a way to do this with a list of type "Content Constant"?

    Basically I have a list of data about constants and I want to get the type of each. I tried fn!typeOf("cons!" & fv!item) where fv!item is the constant's name. That just returned text for everything since it's technically text.  I tried fn!typeOf(fv!item) where fv!item is the constant itself and it returns "Content Constantfor everything since they are constants (instead of telling the type of data the constant holds).

    I am getting the constants with the Content Tools plugin and this code:

    local!constants: a!flatten(
      a!forEach(
        items: ri!constantFolders,
        expression: fn!getconstantsfromfolder(
          rootFolder: fv!item,
          recursiveSearch: true
        )
      )
    )

    Thank you!

Children