B4J Question How to evaluate functions and / or operations based on the content of an external file at run time?

Discussion in 'B4J Questions' started by Gabino A. de la Gala, Jun 10, 2019.

  1. Gabino A. de la Gala

    Gabino A. de la Gala Active Member Licensed User

    Hi. I am investigating to see what would be the most suitable approach to face this need that I am considering:

    I have to print labels on a Zebra printer. The different printing formats of the labels are stored in .frm files in the same folder as the application.

    In those files I have the control codes typical of the printer (which are fixed) and interspersed between these control codes I have interleaved fields of the database that I substitute for their values at run time. The fields go to the @FieldName style.

    So far so good. The problem arises now that I need to apply functions on some of these fields so that when printing the label they exit correctly. For example, date fields that are stored in ticks in the database, but in the label I have to put them in "human" format. Hence the need that arises from being able to intersperse functions within said format and then make substitutions on the fly.

    For example. One of the lines would be: ^ FO25,285 ^ A0,45,30 ^ FDFECHA: DateStr (@DateInTicks, "dd / MM / YYYY") ^ FS

    Well the question would be that I made the call to the DateStr function and that it returned me 01/30/2019.

    The functions would have to have previously defined in the program so that it knew what operations to do at any time, but that is another battle

    Greetings and thank you....
  2. wl

    wl Well-Known Member Licensed User

  3. Gabino A. de la Gala

    Gabino A. de la Gala Active Member Licensed User

    I do not quite understand how this library works.

    In what language do you really have to write the commands?

    How can the functions be called / used?

    Could you give me a simple example to start from?

  4. wl

    wl Well-Known Member Licensed User


    I'm not the writer of the library, but if you download the library you will find an example project. It is in fact a Basic interpreter, so you write the expressions/code/... in a Basic language.
  5. Erel

    Erel Administrator Staff Member Licensed User

    No need to overcomplicate it. Use CallSub with the commands. Make sure to add underscores to the sub names if you want to obfuscate your app.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice