Crystal if-then using text


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Crystal if-then using text

  1. #1
    Join Date
    Oct 2008
    Posts
    38

    Smile Crystal if-then using text

    I need to devise a way to use a if then or some other statement to use text to return a number
    ex.
    if car = "toyota" or "honda" then 5
    else
    if car = "buick" then 4
    else
    3

    the example above didn't work
    any suggestions?

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    How about using a variable
    Code:
    Dim intCar As Integer
    
    Select Case car
       Case "toyota","honda" 
          intCar = 5
       Case "buick" 
          intCar = 4
       Case "chevolet"
          intCar = 3
       'etc
    End Select
    would that work for you?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Oct 2008
    Posts
    38
    when I typed it up this way:
    select case car
    case "toyota", "honda", "nissan", "bmw", "mercedes-benz"
    intcar = 5
    case "buick", "isuzu", "mitshubishi", "subaru", "ford", "lincoln-mercury"
    intcar = 4

    it gave me the following error,
    higlighted the word cas in the first line and said

    a number, currency amount, date, time, boolean or string is expected here.

    What did I do wrong?
    what does dimint mean in your first reply?
    I haven't used Crystal in a few years, so I'm fuzzy on some of this.

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Oops...I forgot you are using Crystal Reports, not VB.

    For crystal snytax, have a look at this.

    http://msdn.microsoft.com/en-us/libr...70(VS.80).aspx
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  5. #5
    Join Date
    Oct 2008
    Posts
    38
    That worked, Thank you!!!

  6. #6
    Join Date
    Jul 2009
    Location
    Chennai
    Posts
    3

    if-then statement in crystal reports

    stringVar car;
    if car = "toyota" or car ="honda" then 5
    else
    if car = "buick" then 4
    else
    3

    Simply check car ="honda" after 'or' condition. It works fine
    Regards,
    Prabin
    Last edited by prabin; 07-24-2009 at 08:35 AM.

Similar Threads

  1. Importing text file using schema.ini
    By Kevin in forum VB Classic
    Replies: 3
    Last Post: 12-05-2005, 06:25 PM
  2. Replies: 1
    Last Post: 11-08-2005, 08:42 AM
  3. Working with Crystal Report Ver 10
    By AM003295 in forum VB Classic
    Replies: 4
    Last Post: 08-12-2005, 09:13 PM
  4. Script for scrolling
    By Mark in forum Web
    Replies: 3
    Last Post: 08-30-2001, 11:45 AM
  5. Double Text 1.0
    By George Gilbert in forum vb.announcements
    Replies: 0
    Last Post: 08-19-2001, 11:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center