Relevance Help - Remove the Zero's

I prefer to do the != 0 after it is already an integer because otherwise 00 could get passed through that filter.

sum of (it as integer) whose(it != 0) of (it as trimmed string) of following texts of

See here:

Q: (it as trimmed string) whose(it != "0") of ("0";"1";" 00  "; " 2 ")
A: 1
A: 00
A: 2
T: 0.091 ms
I: plural string

Using (it as trimmed string) is not a bad idea since (it as integer) won’t handle white space:

Q: (it as integer) of ("0";"1";" 00  "; " 2 ")
A: 0
A: 1
E: Singular expression refers to nonexistent object.

all together:

Q: (it as trimmed string as integer) whose(it != 0) of ("0";"1";" 00  "; " 2 ")
A: 1
A: 2
T: 0.196 ms
I: plural integer

and:

(it as trimmed string as integer) whose(it != 0) of following texts of lasts "<FSTotalSize>" of preceding texts of lasts "</FSTotalS                                                                                                                                                             ize>" of lines containing "FSTotalSize" of files "/var/opt/BESClient/LMT/C                                                                                                                                                             IT/detailed_hw_output.xml"

Also, you don’t need to exclude 0 when summing:

sums of (it as trimmed string as integer) of following texts of lasts "<FSTotalSize>" of preceding texts of lasts "</FSTotalS                                                                                                                                                             ize>" of lines containing "FSTotalSize" of files "/var/opt/BESClient/LMT/C                                                                                                                                                             IT/detailed_hw_output.xml"

I’m guessing this is related: Get Disk Space Used

2 Likes