Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: using Instr Post Reply Post New Topic
Author Message
Pinto
Newbie
Newbie
Avatar

Joined: 14 Sep 2007
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote Pinto Replybullet Topic: using Instr
     Posted: 19 Jun 2009 at 6:01am
I am passing a parameter from an asp.net web page that is a string built like this
 
"202, 303, 406, 504"
 
I want to find out if a number is present in that string. I am using instr like this
 
'other criteria here' and
instr({vweShowAnswers.ANS_QId},{?Skill})> 0
 
When I try to save theselect I get the error,' not enough arguments have been given to this function' ANS_QId is a numeric field in a SQL table
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 19 Jun 2009 at 6:22am
It might want a string instead of a numeric.
 
Also, the usual layout instr(stringToBeSearch, valueToLookFor) so I would have thought:
instr({?Skill}, totext({vweShowAnswers.ANS_QId},0,"") )
should work...
 
yeah, just looked at help.  since your first value is a number, it is thinking that you want to START looking at that location in your string.  Make it a string and the error will go away.
 
HTH
IP IP Logged
Pinto
Newbie
Newbie
Avatar

Joined: 14 Sep 2007
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote Pinto Replybullet Posted: 19 Jun 2009 at 6:50am
I'm getting an error now 'A boolean is required here' when i try and save it
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 19 Jun 2009 at 7:13am
'other criteria and
instr(...)>0
 
you did add the >0? just checking, I was after the syntax.  Otherwise I am at a loss.  Maybe some other part of the criteria is failing?  Try commenting out parts and see if that narrows down where the error is occurring.
 
HTH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Jun 2009 at 7:13am
instr({?Skill}, totext({vweShowAnswers.ANS_QId},0,"") ) will give you a number
 
instr({?Skill}, totext({vweShowAnswers.ANS_QId},0,"") )>0 will give you the True False you are looking for.
IP IP Logged
Pinto
Newbie
Newbie
Avatar

Joined: 14 Sep 2007
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote Pinto Replybullet Posted: 19 Jun 2009 at 7:17am
oops, no I didn't thank you it saves fine now.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum