templates and restful apis

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

templates and restful apis

Post by Dino »

do you remember templates right?

I found myself using templates for server routines, mthroutines, or just small group of lines that I frequently use, for example:

Code: Select all

Define_Com Class(#XPRIM_OSUtil) Name(#OSUtil)
If (*OSAPI = "IBMI")
#OSUtil.SetEnvironmentVariable Name('LANSA_XLIB_CONFIG') Value('/tmp/lansaxlib.configas400.json')
#OSUtil.SetEnvironmentVariable Name('LANSA_XLIB_TRACEPATH') Value('/LANSA_G14PGMLIB/tmp/log.txt')
Else
#OSUtil.SetEnvironmentVariable Name('LANSA_XLIB_CONFIG') Value('c:\temp\lansaxlib.config.json')
#OSUtil.SetEnvironmentVariable Name('LANSA_XLIB_TRACEPATH') Value('c:\temp\log1.txt')
Endif
every time I want to review the output of a json routine, I need to add those lines. Instead of copy paste from other programs, I just created a new template (File, New, Template), and every time I need that set of lines, I just click the icon for template in the editor, select the respective template, and bring that code into my program.
template01.png
template01.png (25.45 KiB) Viewed 8858 times
some templates make questions and create something more customized, but even the simpler ones with fixed code for example with the typical structure of a restful consumption, reduce my time to coding... just saying.
template02.png
template02.png (67.77 KiB) Viewed 8858 times
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: templates and restful apis

Post by atostaine »

LOL I thought this post was from the future and then I realized it is. This server is on aussie time. :D
Art Tostaine
René Houba
Posts: 220
Joined: Thu Nov 26, 2015 7:03 am

Re: templates and restful apis

Post by René Houba »

Hi,

I'm almost finished the new LANSA Technical newsletter. In this, I have a tip created by my colleague Jurgen Rentinck where we show a Reusable Part to handle http loggings ;-)
adale
Posts: 210
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: templates and restful apis

Post by adale »

One more time saver is that if you have "Auto Complete" turned on, the IDE source editor will recognize your template names just like any other Lansa command. Type in the beginning, or full, template name and press enter, and your source code is populated.
Arlyn Dale
Servias LLC
Post Reply