Using multiple logic files

Other discussions about CSPro
htuser
Posts: 249
Joined: December 19th, 2011, 6:26 pm
Location: HAITI

Using multiple logic files

Postby htuser » March 5th, 2017, 11:30 am

Dear Developer team,
I'm trying to use multiple external logic functions to a new application. But i need some helps:
1.- if i add a ressources folder, can i use files, by example logics files, from the ressources folders inside my applications usings keywords such as: import, include use, require__dir__ in the Global proc to call theses ressources?
2.- How many logic file can i use in a application? Can i both, add directly logic files and/or put them in the ressources folder?
3.- Can i use some wildcard variable for dynamic variable purpose in logic?

4.- Greg publish about that long ago. But now, i can't download docs he refer us, please can we have theses docs or more?

Thanks in advance,


-----------------
TOPIC REVIEW: MULTIPLE LOGIC FILES
Re: Multiple logic files
Post by Gregory Martin » January 17th, 2012, 11:55 am

Mutua,

You can see an example here:

http://www.csprousers.org/2011/12/09/ad ... pplication

This could be useful for people who create libraries of functions. The same library of functions could be used in many applications. Think of this as similar to include in C/C++ or import in Java.

josh
Posts: 1227
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Using multiple logic files

Postby josh » March 5th, 2017, 12:50 pm

1) External logic files should not go int the resource folder. Resource folders are for files that are needed on the tablet at runtime. Logic files are used only when you are developing. All logic files in your application will be compiled into your pen file when you publish. You would put a logic file into the resource folder if you want your enumerators to be able to read it.

To add a logic file, create the file in an external editor (like Notepad) and then from CSPro choose File-->Add File and click on the ... next to Logic File and browse to the file you created.

There is no need for import,require or anything like that. All logic files in your application are automatically included. All code in the logic files you add become part of your proc global.

2) You can add as many logic files as you want.

3) What do you mean by wildcard variables.

4) Greg would have to dig up his example but there isn't much to external logic files. Just add one and you can put functions and global variables in it that you can use in your projects. I rarely use them but if you have a bunch of different applications that need to share the same function it can be useful if you don't want to cut and paste.


Return to “Other”