External files


Is it possible to export a lianja .dbf file back into a vfp .dbf file. We need to copy some data into legacy vfp software to keep our system functioning while software is getting rewritten. — can’t seem to delete the post, but found that I could export the data using a text file.


There are several ways to do this. If this is a one off, then use the copy command with a delimited type. Then import that into your VFP table.


If this is something you plan to do often, then probably setting up an ODBC conncetion to lianja makes the most sense.

Lianja provides tight integration with the command shell. The ` … ` command sequence (backticks) can be used to run external shell commands that are piped together and to substitute the output into a Lianja character string.

After select/copy/paste these examples in Console workspace on usual Windows:

? "`cmd /c date /t`"    // works OK

? "Date is `date`"     // does not work

Barry uses cygwin and both commands work for him.
If it is not easy to find backtick on the keyboard, the code for backtick is ALT+96

I’ve tested the proper formatted commands using back ticks and they work as expected.

On further investigation I’ve found that it appears that when I “run cmd” from Lianja, it is cmd.exe that is hanging. Lianja is simply waiting for cmd.exe to finish. If I shut down cmd.exe from task manager, Lianja continues just fine.

So the crash is definitely an issue with my system and, as you say, since I have no reason to ever need to this in my code, it’s not even an issue.

I have simplified this behavior on Windows in Lianja 3.4RC14. You now no longer need to specify cmd /c you can just use the backticks but remember that the command itself must be a valid windows command that produces output.

? “The date is `date /t`”


with Lainja.SpawnApp() I can call other app.

EG: lianja.SpawnApp(“lianjademo”), start the app, but the deployed app, not the “building app”.

Can I set the window size of the opened app?


Lianja.spawnApp() only takes an app name not command line args.

You should use spawn() or run() if you want to specify command line args.


run(“C:\lianja\bin\lianjaruntime.exe –utf8 –debug –nosplashscreen –app sampleproductsentry –geometry 10,10,800,600”)

and it work.. 🙂

so, I can:

Lianja.sessionStorage.setItem("p_retvalue", False)
run("C:\lianja\bin\lianjaruntime.exe --utf8 --debug --nosplashscreen --kiosk --app sampleproductsentry --geometry 10,10,800,600")
value = Lianja.sessionStorage.getItem("p_retvalue")	

in my “sampleproductsentry” app I do:

Lianja.sessionStorage.setItem("p_retvalue", PRODUCTS.PRODUCTID)

from the first app, I call the second, when the user close it, the control return to the first and I can read the value passed.


Lianja.spawnApp conveniently allows running a .dbo (compiled prg) directly, as so:

lcDbo = “myprg.dbo”
lcPathedDbo = set(“dire”) + lcDbo

Here’s the challenge: I’m launching this from a web service (.rsp page application/json), and need to have the .dbo accept a parameter so that it processes a particular instance based on data pointed to by the parameter.

Although SessionStorage might look like an answer, that has the same issue: I would need to communicate the “key” for the .dbo to access.


You cannot use Lianja.spawnApp() from a server page. The Lianja system object is only available in the clients I.e desktop, web or mobile.

Lianja.spawnApp() is desktop specific as it relies on being called from the lianja runtime client.

Rather than spawning a process from inside a web service I’d recommend you implement a consumer/producer architecture which will be much more scaleable.

See my post in these forums on resource locks.

You could add request records to a table in the web service always locking a known resource exclusively beforehand.

You then have a background job (using cron on linux or task scheduler on Windows) running that reads records from the table and processes the requests. When there are no more requests, lock a known resource and zap the table then unlock the resource.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.