Page 1 of 1

String literal cheat sheet

Posted: Thu Oct 12, 2017 3:49 am
by VLNinja70
Hey guys,
So this isn't really much of a question but more of a what do you think post... ;)

So I was screwing around with my message box that popup errors for logging in.
I wanted to format the text in the message where there is a new line between sentences int he message.
Coming from the world of Javas, Python and C, I figured that I just stick a /n in my string and everything would be good.
But, in LANSA, it actually took my /n literally.

So digging around in the forum searching for new line I found this post
viewtopic.php?f=3&t=1399&p=2928&hilit=new+line#p2928

So now my message shows up the way I like it.
One thing thats bugging me about this was hunting for this on the doco site.

First you have to search for carriage return (not new line) to find something about this.
http://docs.lansa.com/14/en/lansa016/PR ... INSICS.htm

Then when you find asUnicodeString, turns out thats under the Integer Primitive.
I get that you are modding a integer to a special character but my brain was working with strings so I wouldn't think to look there.

*/ Rant mode: offline */

Anyway I was thinking that to make this much easier for the future LANSA n00bs out there (like myself :D ), I'd think it be great to have a LANSA Literal character translator.
Just a page in the doco that says, here is all the basic literals in LANSA and quick examples in how to use them.
Want to use /n? use (10).AsUnicodeString
How about /t? use (9).AsUnicodeString

What do you guys think?

Re: String literal cheat sheet

Posted: Thu Oct 12, 2017 6:19 pm
by HMJust
I agree with you, and thank you for reminding me how to get these characters as strings. I forgot that...

About strings and integers, my "favorite" feature is the string intrinsics AsInteger and AsNumber which I wrote about here: https://lansa123.wordpress.com/2017/03/ ... -asnumber/

(for those that can't remember exactly, AsInteger returns the character code of the first character in the string, where as AsNumber tries to convert the string into a numeric value)

If you read the documentation, you see that AsInteger is "Return the variable as an integer" whereas AsNumber is "Return the variable as a number" and for a long time I missed the subtle difference between "integer" and "number" in this context.

LANSA Intrinsics are not well documented / searchable

Posted: Thu Feb 17, 2022 2:43 am
by LANSAfolks
This whole area of LANSA intrinsic functions is there from the initial days of RDMLX and is not well documented.

If anyone from LANSA is taking note, please do the following:
1. List all available LANSA intrinsics in one page (for good search results).
2. Document each intrinsic with good (usable) examples.
3. Then group those into categories on a separate help page.

Re: String literal cheat sheet

Posted: Thu Feb 17, 2022 4:08 am
by Dino
I will help with 1. in this page

https://docs.lansa.com/15/en/lansa016/c ... /index.htm

search intrinsics once in that page.

some have good examples.

Re: String literal cheat sheet

Posted: Fri Feb 18, 2022 5:35 am
by LANSAfolks
Unfortunately, that's not a list of Intrinsic functions but a list of Visual LANSA Component classes e.g. search for intrinsic AsUnicodeString, what do you get as your search results? Or simply try searching for "unicode" to see what unicode intrinsics are available in LANSA. Do you see anything useful come back in the results, regarding intrinsics? Search here: https://docs.lansa.com/15/en/

Re: String literal cheat sheet

Posted: Fri Feb 18, 2022 6:14 am
by Dino
Intrinsics are mostly related to field types and all listed in that link.
if you want intrinsics for...

binary fields: https://docs.lansa.com/15/en/lansa016/c ... insics.htm
boolean fields: https://docs.lansa.com/15/en/lansa016/c ... insics.htm
date fields : https://docs.lansa.com/15/en/lansa016/c ... insics.htm
string fields: https://docs.lansa.com/15/en/lansa016/c ... insics.htm
unicode fields: https://docs.lansa.com/15/en/lansa016/c ... insics.htm
etc.
intrinsics.jpg
intrinsics.jpg (372.67 KiB) Viewed 36891 times