From troubleshooting technical issues and product recommendations, to quotes and orders, we’re here to help.
Contact Us
DIAdem (for Analysis and Visualization)
SystemLink (Test Operations)
OptimalPlus GO (Manufacturing Analytics)
SERVICES
View All Services
Repair Services
Calibration
Training Courses
HARDWARE
View All Hardware
Data Acquisition and Control
Learn About DAQ
New DAQ Hardware (mioDAQ)
Multifunction I/O
Voltage
Digital I/O
Temperature
Sound and Vibration
Current
Strain, Pressure, and Force
Communication Interfaces
Software Defined Radios
GPIB, Serial, and Ethernet
Industrial Communication Buses
Vehicle Communication Buses
Avionics Communication Buses
PXI Instrumentation
Switches
Oscilloscopes
Digital Multimeters
Waveform Generators
RF Signal Generators
SMUs and LCR Meters
Power Supplies and Loads
Vector Signal Transceivers
FlexRIO Instruments
Accessories
Power Accessories
Connectors
Cables
Sensors
RESOURCES
Ordering Resources
Distributors
System Advisors
See all products
CompactDAQ
Modular Data Acquisition
Perspectives
Perspectives showcases how NI sees what’s next in the world of test and technology.
View all articles
LabVIEW remains key in test, promising speed, efficiency, and new features with NI’s investment in core tech, community, and integration.
Read our featured article
Request Support
You can request repair, RMA, schedule calibration, or get technical support. A valid service agreement may be required.
Open a service request
Popular Software Downloads
See all Software Product Downloads
LabVIEW
DIAdem (for Analysis and Visualization)
SystemLink (Test Operations)
OptimalPlus GO (Manufacturing Analytics)
SERVICES
View All Services
Repair Services
Calibration
Training Courses
HARDWARE
View All Hardware
Data Acquisition and Control
Learn About DAQ
New DAQ Hardware (mioDAQ)
Multifunction I/O
Voltage
Digital I/O
Temperature
Sound and Vibration
Current
Strain, Pressure, and Force
Communication Interfaces
Software Defined Radios
GPIB, Serial, and Ethernet
Industrial Communication Buses
Vehicle Communication Buses
Avionics Communication Buses
PXI Instrumentation
Switches
Oscilloscopes
Digital Multimeters
Waveform Generators
RF Signal Generators
SMUs and LCR Meters
Power Supplies and Loads
Vector Signal Transceivers
FlexRIO Instruments
Accessories
Power Accessories
Connectors
Cables
Sensors
RESOURCES
Ordering Resources
Distributors
System Advisors
See all products
Resources
View All Support Resources
Software Downloads
Register and Activate
Product Documentation
Release Notes
Training Courses
On-Demand Learning
KnowledgeBase
Code Examples
Popular Software Downloads
See all Software Product Downloads
icon of LabVIEW logo
icon of Multisim logo
icon of Academic Volume License logo
Popular Driver Downloads
See all Driver Software Downloads
NI-DAQmx
NI-VISA
NI-488.2
Request Support
You can request repair, RMA, schedule calibration, or get technical support. A valid service agreement may be required.
Open a service request
i intend to match a substring of the string returned from my UUT when using a String Value Test - VI call.
I write the returned string to a Local Variable type String (Locals.data_read) and in the Limits Tab - under Expected String Value am using Find(Locals.data_read, "Connected"). When i Check the expression for Errors - i get a warning "Expected String, found Number {64-bit Floating Point}. this value will cause a run-time error."
What am i missing?
Thanks
The Find function evaluates to a number:
Number Find(String string, String stringToSearchFor, Number indexToSearchFrom = 0, Boolean ignoreCase = False, Boolean searchInReverse = False)
Returns: The zero-based character index, starting at the beginning of the string, of the first character in the substring. The function returns -1 if it does not find the substring.
It looks to me like you need to do a numeric step type. Not a string value test.
Or you can do something like this:
Find(Locals.data_read, "Connected") < 0 ? "Doesn't Matter What Is Here" : Locals.data_read
Hope this helps,
sorry - i'm not getting it...
Using <<Find(Locals.data_read, "Connected") < 0 ? "Doesn't Matter What Is Here" : Locals.data_read>> in the String Value Test didn't work.
And if i use a Numeric step type - under Limits-> Comparison Type - the expression Find(Locals.data_read, "Connected") is not accepted ?
cheers
I know this is an old thread but I have a question about this solution.
I the attached sequence this "Find(Locals.data_read, "Connected") < 0 ? "String Did Not Contain Connected"
" : Locals.data_read" is stated in limits for step "Evaluate string"
I don't understand what this is for "String Did Not Contain Connected"
" : Locals.data_read", because no matter what the text you are validating, this text will not show in Locals.data_read, if Connected is not pressent. The text that will be in the variable is the text you type in step "Get string".
Another question is. How can i set it up to find more than one text?
I need it to find out if one of 3 differeret sentence or words is pressent in the stream from a RS232 port and save the one that is pressent in a variable. I need this to chose what to do next in the sequence.
Hope someone can help.
Thanks in advance:)
Best regards Bjarne
I would recommend starting a new thread and referencing this one in the future. That will help keep each issue independent to make searching easier.
@Briton
wrote:
I know this is an old thread but I have a question about this solution.
I the attached sequence this "Find(Locals.data_read, "Connected") < 0 ? "String Did Not Contain Connected"
" : Locals.data_read" is stated in limits for step "Evaluate string"
I don't understand what this is for "String Did Not Contain Connected"
" : Locals.data_read", because no matter what the text you are validating, this text will not show in Locals.data_read, if Connected is not pressent. The text that will be in the variable is the text you type in step "Get string".
The Data Source is Locals.data_read. If the data read contains the word "Connected" then it is a pass for the step because the Expected String Value will evaluate to the same thing as the Data Source. This is how the String Value Test Step Type Works. You can see this in the Status Expression. The actual reading will always show on the report because it is the Data Source.
@Briton
wrote:
Another question is. How can i set it up to find more than one text?
I need it to find out if one of 3 differeret sentence or words is pressent in the stream from a RS232 port and save the one that is pressent in a variable. I need this to chose what to do next in the sequence.
You could use nested conditional statements but that could get out of hand quickly if you go beyond a few of these statements.
Find(Locals.data_read, "String1") < 0 ? (Find(Locals.data_read, "String2") < 0 ? (Find(Locals.data_read, "String3") < 0 ? "String Did Not Contain Connected" : Locals.data_read): Locals.data_read) : Locals.data_read
As for chosing what to do next in the sequence what are your options? You can use the Post Action, an engine callback or many different ways to go from here.
Cheers,