Skip to main content
Solved

JSONTemplator - Cast value types from a list?


virtualcitymatt
Celebrity
Forum|alt.badge.img+35

I have a list attribute that I'd like to use in a JSONTemplator. I am able to get the list into an array no issues, however, I want the result to be an array of integers/numbers rather than a string. If it was not a list I can use the xs:integer to try to force it to be an integer, however, I'm not quite sure how I should do this for values in a list. Any ideas on this?

Best answer by takashi

Hi @virtualcitymatt​ , a possible way is to use an XQuery expression like this. Assuming that every element of the list represents integer value.

[
    for $v in fme:get-list-attribute('_list{}.number')
    return xs:integer($v)
]

 

View original
Did this help you find an answer to your question?

2 replies

takashi
Influencer
  • Best Answer
  • August 20, 2020

Hi @virtualcitymatt​ , a possible way is to use an XQuery expression like this. Assuming that every element of the list represents integer value.

[
    for $v in fme:get-list-attribute('_list{}.number')
    return xs:integer($v)
]

 


virtualcitymatt
Celebrity
Forum|alt.badge.img+35
takashi wrote:

Hi @virtualcitymatt​ , a possible way is to use an XQuery expression like this. Assuming that every element of the list represents integer value.

[
    for $v in fme:get-list-attribute('_list{}.number')
    return xs:integer($v)
]

 

And that is why they call you the best. Thanks @Takashi Iijima​ . 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings