Page 1 of 1

Macro

PostPosted: Fri Nov 17, 2017 1:41 pm
by Jeff Barnes
I'm playing around with an idea (using FWH and xHarbour).

I have a text file, in this file I want to put some code.

Sample code (not the code in the text file):

Code: Select all  Expand view

#include "FiveWin.ch"

Function Main()
   LOCAL cText:=MemoRead("myfile.txt")
   &cText
Return Nil
 


The above works if the text file has:
Code: Select all  Expand view
MsgInfo('Hello World')


If I change the text file to have:
Code: Select all  Expand view
IIF( EMPTY(cText), MsgInfo('cText is empty'), MsgInfo('cText is NOT empty')  )

It also works.

Now, if I have the following in my text file it does not work (generates an error: Syntax Error &):

Code: Select all  Expand view
IF EMPTY('cText')
   MsgInfo('cText is empty')
ELSE
   MsgInfo('cText is NOT empty')
ENDIF


Any ideas?

It's not easy to explain why I want to do this but I will give it a shot...

I am importing data from many different medical systems.
I have a config file that let's me setup start/end points to grab data, something like:
<STARTDATE>10/10/2017</STARTDATE>
<STARTTIME>11:49AM</STARTTIME>

Some systems will have the data a little different:
<STARTDATE>10/10/2017 11:49AM</STARTDATE>

So both date and time are in the same segment.

So I was thinking, in my config file I could have a memo field for each item that would allow me to have code so I can strip out the date and the time if they are in the same segment.

This is a very basic example but I hope it gives the right idea as to what I'm trying to do.
I'm trying to stay away from hard coding some of this so it will be easy to add more systems that I can import from.

Re: Macro

PostPosted: Sat Nov 18, 2017 12:34 am
by Armando
Jeff:

what if you remove the apostrophes?

Code: Select all  Expand view

IF EMPTY('cText')
 


Regards

Re: Macro

PostPosted: Sat Nov 18, 2017 12:01 pm
by Jeff Barnes
That was a typo, I didn't actually have the quotes around cTest:

IF EMPTY(cTest) is what I actually have.

I'm working on switching over to Harbour to try out the scripting features but I'm getting compile errors (started another post regarding this).