Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am using the len() function in a numeric field to reduce the records but the function doesn't seem to be working correctly.
What do you think might be causing this?
Where is gmeternumber? Is it the same thing as MPRN - Gas from the screenshot?
oh yes, I just renamed the lable of the field. And my expression to check the length is
,Len(Trim("gmeternumber")) As Length
Something doesn't seem right... can you share the script for this table?
Is your gmeternumber maybe filled up to a length of 10 with white spaces like chr(160), that won't be trim'med?
(But you can replace it with a '' by using Replace(FIELD,chr(160),'') )
What's the source of the data?
You can also try an expression in your chart like
=Ord(Mid( FIELD, 5,1))
Ord() returns the Unicode code point number of the first character of the input string.
Mid(FIELD,5,1) will return the 5th character. Play around, change 5 with any number between 1 and 10 to see what your field values characters look like.
edit: corrected copy&paste failure from the Ord() HELP file
Stefan,
Here's a fun variation of your idea that will display the ord() values of all chars in the string at once:
=concat(
ord(
mid('$(=String)'
,ValueLoop(1,len(String))
,1)
)
,','
)
Caveat: I've only been able to make this work if there is only a single value for String selected -- because ValueLoop has to be a constant.
-Rob
Nice idea!
I've used something like
=concat(
ord(
mid(String
,ValueLoop(1,$(=max(len(String))))
,1)
)
,','
,ValueLoop(1,$(=max(len(String))))
)
in a chart with dimension String. (The second Valueloop is handling the correct sort order of the ASCII codes).
If the String shows less then Max length, zero ASCII code number will be added.
Number | Length | =concat( ord( mid(Number ,ValueLoop(1,4) ,1) ) ,',' ,ValueLoop(1,4) ) |
---|---|---|
920 | 3 | 57,50,48,0 |
1306 | 4 | 49,51,48,54 |
3203 | 4 | 51,50,48,51 |
3503 | 4 | 51,53,48,51 |
4296 | 4 | 52,50,57,54 |
4361 | 4 | 52,51,54,49 |
4498 | 4 | 52,52,57,56 |
5894 | 4 | 53,56,57,52 |
5969 | 4 | 53,57,54,57 |
6444 | 4 | 54,52,52,52 |
Cool. I was trying to get something like this to work for a long time. Here's an update to your expression that doesn't have the extra zeros. Also handles when same String appears more than once.
=trim(
Replace(
concat(DISTINCT
if(ValueLoop(1,$(=max(len(String)))) <= len(String)
,ord(
mid(String
,ValueLoop(1,$(=max(len(String))))
,1)
)
,''
)
,','
,ValueLoop(1,$(=max(len(String))))
)
,',',' ')
)