String literal cheat sheet

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
VLNinja70

String literal cheat sheet

Post 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?
User avatar
HMJust
Posts: 53
Joined: Wed May 11, 2016 7:23 pm
Contact:

Re: String literal cheat sheet

Post 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.
I don't know what I am doing, nor how I did it. If it works, luck was involved :geek:
LANSAfolks
Posts: 49
Joined: Thu Oct 10, 2019 9:32 am

LANSA Intrinsics are not well documented / searchable

Post 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.
User avatar
Dino
Posts: 472
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: String literal cheat sheet

Post 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.
LANSAfolks
Posts: 49
Joined: Thu Oct 10, 2019 9:32 am

Re: String literal cheat sheet

Post 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/
User avatar
Dino
Posts: 472
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: String literal cheat sheet

Post 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 36890 times
Post Reply