In javascript, for example, white space is pretty much ignored by the interpretor. You can spread your code over as many lines as you think makes it more readable, just don't forget to indicate the end of the line with a semi-colon. However, Uniface doesn't allow this, it uses the carriage return as the end of line character. So what do you do if you have a really long line of code?
Well, for me, I tend to just leave it as a very long line of code. If it gets too long, I'll ask my boss for an even bigger monitor :)
I suffer a little with this practice when I'm developing on my laptop though, as I was yesterday. This reminded me about something that I've seen used before, and that's using a Uniface feature that allows you to split a single line of code over multiple lines, like this...
I'm sure this is something that's documented, but what do you search for to find it? I certainly couldn't find anything. So here's a little tip for you, if you prefer to keep those lines a little shorter.
One situation I have used it in before is with a long SQL command or selectdb statement, as it can help to format it in a similar way to how you might write the SQL in your favourite database tool. For example...
EDIT: Uniface calls this the "Line Continuation Marker" and it is documented as such.
If anyone knows where this is in the manuals, please leave a comment and let me know.
Summary: It is possible to split a single line of code over multiple lines in Uniface, but you have to do it explicitly.
Well, for me, I tend to just leave it as a very long line of code. If it gets too long, I'll ask my boss for an even bigger monitor :)
I suffer a little with this practice when I'm developing on my laptop though, as I was yesterday. This reminded me about something that I've seen used before, and that's using a Uniface feature that allows you to split a single line of code over multiple lines, like this...
if ( value != "1" & value != "2" & value != "3" & %\
value != "4" & value != "5" & value != "6" & %\
value != "7" & value != "8" & value != "9" )
value = "0"
endif
I'm sure this is something that's documented, but what do you search for to find it? I certainly couldn't find anything. So here's a little tip for you, if you prefer to keep those lines a little shorter.
One situation I have used it in before is with a long SQL command or selectdb statement, as it can help to format it in a similar way to how you might write the SQL in your favourite database tool. For example...
selectdb max(field6) from
"entity"
u_where
( %\
(field1 = value1)
& %\
(field2 = value2)
& %\
(field3 = value3)
& %\
(field4 = value4)
& %\
(field5 = value5)) to (value6)
EDIT: Uniface calls this the "Line Continuation Marker" and it is documented as such.
Summary: It is possible to split a single line of code over multiple lines in Uniface, but you have to do it explicitly.