Hi GaBriella,

One way to debug is to add console.log after each assignment:

let fNode = ...
console.log(fNode)
let media = ...
console.log(media)

And then have the Script Console panel open. Whenever console.log is executed 
in an ADS script, the argument is added to the output in the script console.

In JavaScript, NaN means “not a number” and is often the result of doing maths 
with a value that is not a number (such as a string, or an undefined value, or 
an array). I remember bumping into NaN when I thought I had accessed a 
single-value property, but it was actually multi-valued, returning an 
array-like value.

Richard


> On 22 Nov 2024, at 00:45, 'Branson, GaBriella C' via TopBraid Suite Users 
> <[email protected]> wrote:
> 
> I have a field where I am trying to infer a decimal value using the following:
>  
> let fNode = wfschema.asAnalysisPosition(focusNode)
> let media = fNode.media
> let sum_media = media?.reduce((cur, val) => cur + val.mediaDevelopmentHours, 
> 0)
> let perfSupp = fNode.performanceSupportMaterials
> let sum_perfSupp = perfSupp?.reduce((cur, val) => cur + val.developmentHours, 
> 0)
> let estTime = fNode.estimatedTimeToCompletion
> if(media && media.length > 0 && perfSupp && perfSupp.length > 0 && estTime) 
> (sum_media + sum_perfSupp) * estTime
>  
> It is returning an NaN and I cannot figure out why. I have verified that each 
> of the properties it is looking at has a decimal datatype. How else should I 
> troubleshoot?
>  
> Please let me know if additional information is required. Thanks!
>  
> GaBriella Branson
> Interagency Wildland Fire Data Management – Knowledge Manager
> U.S. Department of the Interior, Office of Wildland Fire 
> Mobile: 907-483-0330 | [email protected] 
> <mailto:[email protected]>
> Follow us online: Website <https://www.doi.gov/wildlandfire> | Facebook 
> <https://www.facebook.com/DOIWildlandFire> | Flickr 
> <https://www.flickr.com/photos/usinterior/albums/72157711571382637/> | X 
> <https://x.com/doiwildlandfire>
> Stay connected! Sign up to receive email updates 
> <https://public.govdelivery.com/accounts/USDOIOWF/subscriber/new>
>  
> <image001.jpg>   <image002.png>
>  
> 
> -- 
> The topics of this mailing list include TopBraid EDG and related technologies 
> such as SHACL.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion visit 
> https://groups.google.com/d/msgid/topbraid-users/CO6PR09MB7319351504DD77749220F2B0DA232%40CO6PR09MB7319.namprd09.prod.outlook.com
>  
> <https://groups.google.com/d/msgid/topbraid-users/CO6PR09MB7319351504DD77749220F2B0DA232%40CO6PR09MB7319.namprd09.prod.outlook.com?utm_medium=email&utm_source=footer>.

-- 
The topics of this mailing list include TopBraid EDG and related technologies 
such as SHACL.
To post to this group, send email to [email protected]
--- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/topbraid-users/09C6290D-4D64-4920-B0A0-B651EDBE3A06%40topquadrant.com.

Reply via email to