Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..
345 views

InStr = True or False?

Jump to solution

Grabbing a value from global sheet and trying to do an InStr on it.  How do I find out if "returnval" is True or False so I can react to this?  Please advise and thanks. -R-

 

strFullString = DataTable.GlobalSheet.GetParameter("SAP_Mbar")
    strlookforString = "has been saved"
      returnval = instr(1,strFullString,strlookforString)
      print returnval
      If returnval = true Then
          print ("yes has been saved was there")
    Else
        print ("nope   has been saved was not there")    
      End If

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: InStr = True or False?

Jump to solution

Hi

 

instr  returns 0  if text is not found or return the initial character position in the string were text was found

Example

Your string is "Hello World"

If you use instr to search "Car"  it will returns 0

If you use instr to search "World"  it will returns 7

 

So my opinion would be a conditional similar to this:

 

 If returnval > 0  then
print ("yes has been saved was there")
Else
print ("nope has been saved was not there")
End If

 

 

 

HP support
If you find this useful, mark Kudos.
Note: The Opinions expressed in my post are mine alone, and do not reflect the opinions of my employer. No warranties express or implied for any answered posted.

The code exposed is provided as-is, free and just as a sample.

View solution in original post

Tags (1)
0 Likes
1 Reply
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: InStr = True or False?

Jump to solution

Hi

 

instr  returns 0  if text is not found or return the initial character position in the string were text was found

Example

Your string is "Hello World"

If you use instr to search "Car"  it will returns 0

If you use instr to search "World"  it will returns 7

 

So my opinion would be a conditional similar to this:

 

 If returnval > 0  then
print ("yes has been saved was there")
Else
print ("nope has been saved was not there")
End If

 

 

 

HP support
If you find this useful, mark Kudos.
Note: The Opinions expressed in my post are mine alone, and do not reflect the opinions of my employer. No warranties express or implied for any answered posted.

The code exposed is provided as-is, free and just as a sample.

View solution in original post

Tags (1)
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.