Macro

Post Reply
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Macro

Post 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

#include "FiveWin.ch"

Function Main()
   LOCAL cText:=MemoRead("myfile.txt")
   &cText
Return Nil
 
The above works if the text file has:

Code: Select all

MsgInfo('Hello World')
If I change the text file to have:

Code: Select all

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

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.
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Re: Macro

Post by Armando »

Jeff:

what if you remove the apostrophes?

Code: Select all

IF EMPTY('cText')
 
Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: Macro

Post 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).
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
Post Reply