BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how do you do this in delphi?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ObjectPascal
View previous topic :: View next topic  
Author Message
HanslH
Guest





PostPosted: Sat Jan 03, 2004 7:15 pm    Post subject: how do you do this in delphi? Reply with quote



In clipper I gave users the oppotunity to set the high-norm value for
a blood test as f.e. '60' (as a string) but also as '50 + 1.2*G',
which would mean: 50 + 1.2 times body weight.
I would substitute bodyweight for G through code and the rest would be
handled by the 'macro' operator &.
Give clipper &('50 + 1.2*40') and it will come with the proper
value. Since macros aren't part of Delphi and I assume Delphi wants to
be as much a solution to problems as the next language I was wondering
how you would do this in Delphi?

P.s. things can become as complicated as the dosage of a injection
being expressed like 0.4 + 0.1*G + 0.22*G^0.7 but also as a 'simple'
lineair weight dependency.

Very curious.
Back to top
Skybuck Flying
Guest





PostPosted: Sat Jan 03, 2004 9:17 pm    Post subject: Re: how do you do this in delphi? Reply with quote



Euhm so you put in a string ? which contains a formula ?

Possibly things that come to mind:

1. Parse the string.

2. Use a scripting language.

3. Find a component or library that does what you want.

4. Try creating a special gui to input those things seperatly.

Just my 5 cents,

Skybuck.

"HanslH" <NOSPAMhh_000001 (AT) xs4all (DOT) nl> wrote

Quote:
In clipper I gave users the oppotunity to set the high-norm value for
a blood test as f.e. '60' (as a string) but also as '50 + 1.2*G',
which would mean: 50 + 1.2 times body weight.
I would substitute bodyweight for G through code and the rest would be
handled by the 'macro' operator &.
Give clipper &('50 + 1.2*40') and it will come with the proper
value. Since macros aren't part of Delphi and I assume Delphi wants to
be as much a solution to problems as the next language I was wondering
how you would do this in Delphi?

P.s. things can become as complicated as the dosage of a injection
being expressed like 0.4 + 0.1*G + 0.22*G^0.7 but also as a 'simple'
lineair weight dependency.

Very curious.



Back to top
James Mauldin
Guest





PostPosted: Sat Jan 03, 2004 9:40 pm    Post subject: Re: how do you do this in delphi? Reply with quote




"HanslH" <NOSPAMhh_000001 (AT) xs4all (DOT) nl> wrote

Quote:
In clipper I gave users the oppotunity to set the high-norm value for
a blood test as f.e. '60' (as a string) but also as '50 + 1.2*G',
which would mean: 50 + 1.2 times body weight.
I would substitute bodyweight for G through code and the rest would be
handled by the 'macro' operator &.
Give clipper &('50 + 1.2*40') and it will come with the proper
value. Since macros aren't part of Delphi and I assume Delphi wants to
be as much a solution to problems as the next language I was wondering
how you would do this in Delphi?

P.s. things can become as complicated as the dosage of a injection
being expressed like 0.4 + 0.1*G + 0.22*G^0.7 but also as a 'simple'
lineair weight dependency.

If you mean "does Delphi have a C-style 'eval' function?" the answer is no.

However, I'm in the early stages of learning how to use windows script to do
this.

1. Import and install Microsoft Script Control (msscript.ocx)
2. Drop the component onto the main form
3. In an appropriate place, add this code (assuming the G = 40
substitution)

var d : Double;
begin
ScriptControl1.Language := 'VBScript';
d := ScriptControl1.Eval('0.4 + 0.1*40 + 0.22*40^0.7');
ShowMessageFmt('%.2f',[d]);
end;

Result is 7.31. Is that right?

-- James





Back to top
Tony J Hopkinson
Guest





PostPosted: Sun Jan 04, 2004 1:15 pm    Post subject: Re: how do you do this in delphi? Reply with quote

On Sat, 03 Jan 2004 20:15:16 +0100, HanslH <NOSPAMhh_000001 (AT) xs4all (DOT) nl>
wrote:

Quote:
In clipper I gave users the oppotunity to set the high-norm value for
a blood test as f.e. '60' (as a string) but also as '50 + 1.2*G',
which would mean: 50 + 1.2 times body weight.
I would substitute bodyweight for G through code and the rest would be
handled by the 'macro' operator &.
Give clipper &('50 + 1.2*40') and it will come with the proper
value. Since macros aren't part of Delphi and I assume Delphi wants to
be as much a solution to problems as the next language I was wondering
how you would do this in Delphi?

P.s. things can become as complicated as the dosage of a injection
being expressed like 0.4 + 0.1*G + 0.22*G^0.7 but also as a 'simple'
lineair weight dependency.

Very curious.

There's masses of delphi code for expression evaluators out there
never mind string parsing, scripting engines.
Because delphi (pascal really) is not an interpretive environment but
a compilative (is that a word ?) one what you are decribing would not
be a macro as it cannot be compiled.
You need to compile in a tool that will interpret the input at run
time




Back to top
HanslH
Guest





PostPosted: Fri Jan 09, 2004 7:19 am    Post subject: Re: how do you do this in delphi? Reply with quote

Calcexpress from
http://delphi.icm.edu.pl/newl/d30/f049_001.htm
does exactly what I needed; small, subtle, easy and free.

Now on to macro's with clipper compatible commands and codeblocks
Smile..






On Sat, 03 Jan 2004 20:15:16 +0100, HanslH <NOSPAMhh_000001 (AT) xs4all (DOT) nl>
wrote:

Quote:
In clipper I gave users the oppotunity to set the high-norm value for
a blood test as f.e. '60' (as a string) but also as '50 + 1.2*G',
which would mean: 50 + 1.2 times body weight.
I would substitute bodyweight for G through code and the rest would be
handled by the 'macro' operator &.
Give clipper &('50 + 1.2*40') and it will come with the proper
value. Since macros aren't part of Delphi and I assume Delphi wants to
be as much a solution to problems as the next language I was wondering
how you would do this in Delphi?

P.s. things can become as complicated as the dosage of a injection
being expressed like 0.4 + 0.1*G + 0.22*G^0.7 but also as a 'simple'
lineair weight dependency.

Very curious.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ObjectPascal All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.