Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I think this forum rocks it has saved my bacon many many times..."

Geography

Where in the world do Tek-Tips members come from?
AnnetteB1305 (TechnicalUser)
16 Apr 12 17:20
I have a field hardware type which I need to only display the second section of the field. i.e an example of the field is:-
English -> Hardware -> Computer (Handheld) -> Fan and I just want to display Hardware. I am trying to use the instr and mid functions but I can't get this to work without doing three different formulae to get what I require.

Thanks in advance

Annette
 
briangriffin (Programmer)
16 Apr 12 17:29

If the field is always populated with the first three elements, and you're always looking for the third one, then this is all you need:

split({HardwareType}," -> ")[3]

If that's not the case, then a different approach is needed - please supply more sample data.


 
AnnetteB1305 (TechnicalUser)
16 Apr 12 17:48
No that's great why didn't I think of split however I am getting an error message a subscript must be between 1 and the size of the array
AnnetteB1305 (TechnicalUser)
16 Apr 12 17:52
Just checked and they don't always have 3 elements however I only want to show the fields that do have 3 elements
briangriffin (Programmer)
16 Apr 12 19:29


if ubound(split({HardwareType}," -> ")) >= 3

then

split({HardwareType}," -> ")[3]

else

"Whatever you want to display"

 
crystalkiwibruce (Programmer)
16 Apr 12 19:29
You could modify Brians suggestion as follows...

Local stringvar array ProdTypes := split({HardwareType}," -> ");
if count(ProdTypes)>= 3 then  ProdTypes [3] else ""

Bruce Ferguson
www.crystalkiwi.com/nlog.htm
 

AnnetteB1305 (TechnicalUser)
16 Apr 12 20:00
Thank you very much, this has been a great help

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close