I think you'd be hard pushed to find a Uniface developer that didn't know that a string variable can be used to hold a list of values. The Uniface list construct uses a gold-semi-colon as the list delimiter, denoted in the manuals as ; but in code looks like ·; - for example...
s = "27/Sep/2012·;28/Sep/2012·;29/Sep/2012"
;27/Sep/2012·;28/Sep/2012·;29/Sep/2012
I spent quite a long time today trying to work out why such a simple thing was not working for me. It took quite a long time for me to realise that I'd accidentally declared (or rather, re-used) a numeric variable. This gives a rather different result...
s = "27/Sep/2012·;28/Sep/2012·;29/Sep/2012"
;27/Sep/2012·;28/Sep/2012·;29/Sep/2012
I spent quite a long time today trying to work out why such a simple thing was not working for me. It took quite a long time for me to realise that I'd accidentally declared (or rather, re-used) a numeric variable. This gives a rather different result...
n = "27/Sep/2012·;28/Sep/2012·;29/Sep/2012"
;27·;28·;29
I wasn't previous aware that a numeric variable could hold a list in this way, but it's handy to know!
The same also works with dates...
d = "27/Sep/2012·;28/Sep/2012·;29/Sep/2012"
;2012092700000000·;2012092800000000·;2012092900000000
Take a look at this screenshot to see the results...
I'm not going to go through all the data types to confirm which ones it works with, but I suspect it would work with all of the simple ones (such as datetime and float) but not with the more complex ones (such as handle and occurrence).
Summary: It's not just string variables that can be used to hold lists; numeric and date variables also can, along with many others I suspect.
No comments:
Post a Comment