Parentheses in Let? Convert value to String?
Moderators: Dorian (MJT support), JRL
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Parentheses in Let? Convert value to String?
I need to read a celcius temperature value from a space delimited data file, convert to F and pass the value with degree sign and F to another program.
Q1. Not a big deal because there's a work around. It doesn't seem like I can do a complex calculation like:
Let>temp=(param_5*1.8 )+32
So I have to do:
Let>tx=param_5*1.8
Let>tamb=tx+32
VBEval>Round(%tamb%,0),tamb
Am I missing something?
Q2. The real problem. How can I concatenate tamb with " °F ". Concat won't do it presumably because tamb isn't a string. Can I convert tamb to a string somehow, or what's another solution?
Q1. Not a big deal because there's a work around. It doesn't seem like I can do a complex calculation like:
Let>temp=(param_5*1.8 )+32
So I have to do:
Let>tx=param_5*1.8
Let>tamb=tx+32
VBEval>Round(%tamb%,0),tamb
Am I missing something?
Q2. The real problem. How can I concatenate tamb with " °F ". Concat won't do it presumably because tamb isn't a string. Can I convert tamb to a string somehow, or what's another solution?
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
This works for concatenating, just add the desired string:
If I start with 100° then I get a message for "212°F"
But this is not working:You need to add
somewhere before you do VBEVAL
Results:
Code: Select all
Message>Temperature is %tamb%°F
But this is not working:
Code: Select all
VBEval>Round(%tamb%,0),tamb
Code: Select all
VBSTART
VBEND
Results:
Code: Select all
VBSTART
VBEND
Input>param_5,Enter Celsius temperature value
Let>tx=param_5*1.8
Let>tamb=tx+32
VBEval>Round(%tamb%,0),tamb
Message>Temperature is %tamb%°F
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Or use complex expressions and just do this:
Let>temp={ Round((%param_5%*1.8)+32) }
Let>temp={ Round((%param_5%*1.8)+32) }
MJT Net Support
[email protected]
[email protected]
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
I did have the VBSTART/END in there, guess it pays to post the whole code so as not to waste helpful you folks time :oops:support wrote:Or use complex expressions and just do this:
Let>temp={ Round((%param_5%*1.8)+32) }
When I add the {complex expression} I get "Operator opMult incompatible with String" and then "Invalid parameters to ROUND". tamb displays correctly and I did do the trailing spaces thing.
VBSTART
''
VBEND
Message>%number%
Let>rp_wait=1
ReadLn>c:\testdir\clientraw.txt,1,line
If>line=##EOF##,finish
Separate>line, ,param
Let>tempx={ Round((%param_5%*1.8)+32) }
Let>tx=param_5*1.8
Let>tamb=tx+32
VBEval>Round(%tamb%,0),tamb
Message>temp: %tamb% %tempx%
Label>finish
The Separate is working OK, the data string is
12345 10.0 9.6 275 11.2 73 1011.1 0.0 0.0 460.2 0.0 0.0 20.7 48 255.0 2 0.0 0 0 0.0
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Hmmmm, I thought that ROUND was available in Macro Scheduler, did a Search and nothing came up. Thought I had confused commands in Macro Scheduler with another unknown program.
Because of this example< I took another look, and it is still not coming up. What is wrong with me? So I did a search on Complex Expressions and ... .... ... voila!.....there it is, along with many other forgotten/hidden functions.
See Arithmetic Expressions in Help
Because of this example< I took another look, and it is still not coming up. What is wrong with me? So I did a search on Complex Expressions and ... .... ... voila!.....there it is, along with many other forgotten/hidden functions.
See Arithmetic Expressions in Help
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Yes, confirmed. Something not right there. It works if you remove decimals. I.e. it appears that it is interpretting 333.33 as a string. 333 works, 333.33 does not in this context. Seems to be an issue with real number variables when being converted into complex expressions.
MJT Net Support
[email protected]
[email protected]
Just to let you know, we've located the cause of this problem and have fixed it for the next release.
MJT Net Support
[email protected]
[email protected]
See: Comlex Expressions:
http://www.mjtnet.com/OnlineHelp/index. ... ssions.htm
and: Let:
http://www.mjtnet.com/OnlineHelp/index. ... d370_2.htm
Let has a couple of examples of complex expressions.
http://www.mjtnet.com/OnlineHelp/index. ... ssions.htm
and: Let:
http://www.mjtnet.com/OnlineHelp/index. ... d370_2.htm
Let has a couple of examples of complex expressions.
MJT Net Support
[email protected]
[email protected]