FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Macro
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Macro
Posted: Fri Nov 17, 2017 01:41 PM
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 (fw): Select all Collapse
#include "FiveWin.ch"

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


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


If I change the text file to have:
Code (fw): Select all Collapse
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 (fw): Select all Collapse
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 16.11, xHarbour 1.2.3, Bcc730)
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Macro
Posted: Sat Nov 18, 2017 12:34 AM
Jeff:

what if you remove the apostrophes?

Code (fw): Select all Collapse
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
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Macro
Posted: Sat Nov 18, 2017 12:01 PM

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 16.11, xHarbour 1.2.3, Bcc730)

Continue the discussion