This is my humble response to my problem.
I resolved my problem late yesterday afternoon. It turns out that an input I
thought was text was coming in as a record and the one I thought was causing
the problem was okay. Once I corrected the input that was actually causing
the problem everything worked fine. I appreciate everyones response.
Mike Gustin
>Hi Everyone,
>
>I am trying to compare a text string with a record text string to see if
they
>are equal, using the relational operator == . When I do this I get an error
>message "Unable to convert text to record" or "Unable to convert record to
>text" depending on how I hook it up.
>
>I have tried using "Get Field" and the A.B syntax in relational expression
to
>extract the field back as text but it does not work.
>
>According to the HP-Vee reference book a dyadic operator, such as
==,supports
>combining records and other data types but it does not seem to work. The
>reference book refers the output as being converted to a record type but
then
>how do you access the record? A relational object should return a 0 or 1
>which confuses the issue more. Besides using a relational object I have
tried
>using conditional objects also with the same result.
>
>I greatly appreciate any help.
>
>Mike Gustin
>mgustin@sme.siemens.com
>
=================================================================
Replies
=================================================================
Mike,
Try using a formula containing Record.A (If Record is the name of the
input record and A is the field you want to compare). It works on both
3.21 and 4.0.
Thanks,
Derek
Derek Basham (970) 679-3030
Mike,
I believe the following will work if you use a formula in an
IF/THEN/ELSE object. In this example, the "B" input pin of the
IF/THEN/ELSE has been renamed "Rec" (you may name the pin any thing you
want, using the A.B syntax, the expression to the left of the dot is the
pin name and the expression to the right is the name of the record
field). This also assumes myField is a text scalar.
+---------------------------+
+------+ | IF/THEN/ELSE |
| TEXT | +---------------------------+
+------+---------------| A | | THEN |
|abcdef| |---| A==Rec.myField |------+
+------+ ---|Rec| | ELSE +
| +---+----------------+------+
+----------------+ |
| RECORD | |
+----------------+ |
|myField| abcdef |---
+----------------+
John D. Seelbinder
Hello Mike,
to compare strings I always use the string operator
strPosStr(str1,str2).
this function returns the position of str2 in str1 or -1 if str2 is not
found. VEE behaves like plain C where you also can not compare strings
with a simple if-statement.
--
Dirk Uwaerts
====================================================================
Thank you for replying.
I have tried all of your suggestions, unfortunately they do not work. I am
using V3.12 running on WIN3.11.
The point about trying to compare two strings with a conditional was a good
point. Unfortunately when I use strPosStr in 3.12 I get the error message
"Function not supported yet for type records" Error 313. I tried putting a
GetField in before it to extract the field but still got the same error.
I have researched this more and came accross this note in the HP-VEE
Reference Manual for version 3.12 on page 3-17
NOTE
The Record data type is not included in this table. Most Math and AdvMath
functions wil not operate on records. If you attempt to do this you will
generate an Invalid operation for data type Record error. The only functions
supported for records are :sort(x), init(x,val), concat(x,y), and totSize(x)
(see the "AdvMath Output Types" table).
The table that this note refers to is the Math Output Types.
The bottom line from what I know now is that the record type is essentially
not supportd in HPVEE 3.12. Though there are a lot of functions to put data
into records and extract fields from records once it is a record type you
are out of luck being able to use the record data with the other data types
(I definitely could not get it to work with text data type)with in HPVEE.
There is no way to recast the data type.
This issue may only be between certain data type such as record(text).
I would appreciate any comments to dispute this.
Frustrated,
Mike Gustin
Siemens Medical
mgustin@sme.siemens.com