bind and evaluate in Clarion 5.5

This is a discussion on bind and evaluate in Clarion 5.5 within the Clarion forums in Programming Languages category; Hi I'm would like to use evaluate and have written the following test program. I works only partly. The procedure AllCapsFunc are executed via Evaluate but it does not return a value into StringVar. Why? Hope that you can help map AllCapsFunc procedure(string), string end Person group,pre(PERS),bindable FirstName string(20) LastName string(20) end NameStr string(20) StringVar string(20) result string(255) bind('FirstName',PERS:FirstName) bind('StringVar',StringVar) bind('SomeFunc',AllCapsFunc) bind('NameStr',NameStr) NameStr='jesper' Person.FirstName = 'Jesper' Person.LastName = 'Nielsen' StringVar = 'peter' result = evaluate('StringVar=SomeFunc(FirstName)') message('3:'&clip(result)) case clip(result) of '' if ErrorCode() message('Error ' & errorcode() & ' -- ' & Error()) else message('Unknown error') end of '0' message('no bind: ...

Go Back   Application Development Forum > Programming Languages > Clarion

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 06-20-2008, 06:19 AM
JNO
Guest
 
Default bind and evaluate in Clarion 5.5

Hi

I'm would like to use evaluate and have written the following test
program.
I works only partly. The procedure AllCapsFunc are executed via
Evaluate but it does not return a value into StringVar. Why?

Hope that you can help



map
AllCapsFunc procedure(string), string
end

Person group,pre(PERS),bindable
FirstName string(20)
LastName string(20)
end
NameStr string(20)
StringVar string(20)
result string(255)

bind('FirstName',PERS:FirstName)
bind('StringVar',StringVar)
bind('SomeFunc',AllCapsFunc)
bind('NameStr',NameStr)
NameStr='jesper'

Person.FirstName = 'Jesper'
Person.LastName = 'Nielsen'
StringVar = 'peter'
result = evaluate('StringVar=SomeFunc(FirstName)')
message('3:'&clip(result))
case clip(result)
of ''
if ErrorCode()
message('Error ' & errorcode() & ' -- ' & Error())
else
message('Unknown error')
end
of '0'
message('no bind: ' & clip(StringVar))
of '1'
message('result: '& clip(StringVar))
end

return

AllCapsFunc procedure(str)
code
message('1:'&clip(str))
str=upper(str)
message('2:'&clip(str))
return(str)

Regards
Jesper
Reply With Quote
  #2  
Old 06-21-2008, 03:36 AM
Simon Kemp
Guest
 
Default Re: bind and evaluate in Clarion 5.5


Hi Jesper,

> I works only partly. The procedure AllCapsFunc are executed via
> Evaluate but it does not return a value into StringVar. Why?


With

"evaluate('StringVar=SomeFunc(FirstName)')"

you are evaluating a logical expression - comparing StringVar with
SomeFunc(Firstname), the result is false and evaluate() returns 0.

Try:-

StringVar=evaluate(SomeFunc(FirstName))


HTH,
Simon


Reply With Quote
  #3  
Old 06-21-2008, 03:53 AM
Simon Kemp
Guest
 
Default Re: bind and evaluate in Clarion 5.5

Sorry, of course that should have been:-

StringVar=evaluate('SomeFunc(FirstName)')


On Jun 21, 8:36 am, Simon Kemp <si...@sdk.demon.co.uk> wrote:
> Hi Jesper,
>
> > I works only partly. The procedure AllCapsFunc are executed via
> > Evaluate but it does not return a value into StringVar. Why?

>
> With
>
> "evaluate('StringVar=SomeFunc(FirstName)')"
>
> you are evaluating a logical expression - comparing StringVar with
> SomeFunc(Firstname), the result is false and evaluate() returns 0.
>
> Try:-
>
> StringVar=evaluate(SomeFunc(FirstName))
>
> HTH,
> Simon


Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 07:43 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.