I am working on a formula in crystal using Visual Basic. I need to pull out lists of workers titles from a set list I have written down. I am using a fairly long if statement here and would like to know if there is a max number of conditions I can use in a given if statement.
Here is an example of what I am using.
*******************************
If (InStr({Concurrence.ConcurrenceName}, " MD", 1) > 0 _
or InStr({Concurrence.ConcurrenceName}, " COS ", 1) > 0 _
or InStr({Concurrence.ConcurrenceName}, ", M.D.", 1) > 0 _
or InStr({Concurrence.ConcurrenceName}, "M.D.", 1) > 0 _
or InStr({Concurrence.ConcurrenceName}, " M D", 1) > 0 _
or InStr({Concurrence.ConcurrenceName}, "D.O.", 1) > 0 _
or InStr({Concurrence.ConcurrenceName}, " DO", 1) > 0 _
or Instr({Concurrence.ConcurrenceName}, " DR.", 1) > 0 _
or Instr({Concurrence.ConcurrenceName}, " DR ", 1) > 0) _
or InStr({Concurrence.ConcurrenceName}, "MD", 1) > 0 _
or InStr({Concurrence.ConcurrenceName}, " DO ", 1) > 0 _
or InStr({Concurrence.ConcurrenceName}, "DR", 1) = 1) then
formula = "Physician"
ElseIf (InStr({Concurrence.ConcurrenceTitle}, "PHYSICIAN", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "ATTENDING", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "ACOS", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "COS ", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "CHIEF MEDICAL", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "CHIEF OF STAFF", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, " M.D.", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, " MD,", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "MD", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "M.D", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "D.O.", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "SURGEON", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "INTERNIST", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "DOCTOR", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, " CHIEFOFSTAFF", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "ANESTHESIOLOGIST", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "CARDIOLOGIST", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "CHIEFSOFSTAFF", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "AOD", 1) > 0) then
formula = "Physician"
End If
For some reason crystal does not pull out the "PHYSICIAN" title in the second if else statement. However, if I put it in its own if statement it will evaluate properly. (I broke the if statement up for maintenance ease)
Like this:
If InStr({Concurrence.ConcurrenceTitle}, "PHYSICIAN", 1) > 0 Then
formula = "Physician"
End If
So, I am wondering if I simply have too long of an if statement and need to break this up in order to get all of the titles I am looking for.
Any suggestions on how long each if statement can be, or possibly a more efficient way to write this?
Thanks in advance.
RyanIf there are many IFs then why cant you use Case statement?sql
Showing posts with label titles. Show all posts
Showing posts with label titles. Show all posts
Wednesday, March 28, 2012
Friday, March 9, 2012
Matrix column titles problem
Hi,
I hope anyone can help me with a problem I've been struggeling with for some
days now?
I have a matrix that should look like this. It has a couple of static
columns at the beginning and variable ones (week numbers) at the end
-----
ID Description ...(More columns)... 200523 200524 20052
-----
abc some description 3
3 4
def something else 7
8 8
etc...
But I only get this:
-----
200523 200524 20052
-----
abc some description 3
3 4
def something else 7
8 8
etc...
So the problem is that I cannot get the titles for the first columns, only
the generated ones for the weeknumbers at the end. The matrix control has
only one text field above all other columns. Obviously I want to show Part
ID, Description, etc... there.
I also want these column names to be visible when this report gets exported
to a csv file.
Does anyone know how to do these two things?
I would really appreciate your help.
Thanks,
EdgarMultiple static columns in a matrix are a bit of an issue.
I think, from your post, you are adding the columns into the main data
area which is why you are getting unexpected results.
You can only get one static column per row grouping as it stands.
However there is a hack!
Create a rectangle outside the matrix, add all the textboxes you want
as static columns into the rectangle, now cut and paste the rectangle
into the row cell in the matrix. The matrix sees it as one column which
keeps it happy, but renders it as you formatted it, which should keep
you happy!
Chris
Edgar wrote:
> Hi,
> I hope anyone can help me with a problem I've been struggeling with
> for some days now?
> I have a matrix that should look like this. It has a couple of static
> columns at the beginning and variable ones (week numbers) at the end:
> ---
> -- ID Description ...(More columns)...
> 200523 200524 200526
> ---
> -- abc some description
> 3 3 4 def something else
> 7 8 8
> etc...
>
> But I only get this:
> ---
> --
> 200523 200524 200526
> ---
> -- abc some description
> 3 3 4
> def something else 7
> 8 8
> etc...
> So the problem is that I cannot get the titles for the first columns,
> only the generated ones for the weeknumbers at the end. The matrix
> control has only one text field above all other columns. Obviously I
> want to show Part ID, Description, etc... there.
> I also want these column names to be visible when this report gets
> exported to a csv file.
> Does anyone know how to do these two things?
> I would really appreciate your help.
> Thanks,
> Edgar
I hope anyone can help me with a problem I've been struggeling with for some
days now?
I have a matrix that should look like this. It has a couple of static
columns at the beginning and variable ones (week numbers) at the end
-----
ID Description ...(More columns)... 200523 200524 20052
-----
abc some description 3
3 4
def something else 7
8 8
etc...
But I only get this:
-----
200523 200524 20052
-----
abc some description 3
3 4
def something else 7
8 8
etc...
So the problem is that I cannot get the titles for the first columns, only
the generated ones for the weeknumbers at the end. The matrix control has
only one text field above all other columns. Obviously I want to show Part
ID, Description, etc... there.
I also want these column names to be visible when this report gets exported
to a csv file.
Does anyone know how to do these two things?
I would really appreciate your help.
Thanks,
EdgarMultiple static columns in a matrix are a bit of an issue.
I think, from your post, you are adding the columns into the main data
area which is why you are getting unexpected results.
You can only get one static column per row grouping as it stands.
However there is a hack!
Create a rectangle outside the matrix, add all the textboxes you want
as static columns into the rectangle, now cut and paste the rectangle
into the row cell in the matrix. The matrix sees it as one column which
keeps it happy, but renders it as you formatted it, which should keep
you happy!
Chris
Edgar wrote:
> Hi,
> I hope anyone can help me with a problem I've been struggeling with
> for some days now?
> I have a matrix that should look like this. It has a couple of static
> columns at the beginning and variable ones (week numbers) at the end:
> ---
> -- ID Description ...(More columns)...
> 200523 200524 200526
> ---
> -- abc some description
> 3 3 4 def something else
> 7 8 8
> etc...
>
> But I only get this:
> ---
> --
> 200523 200524 200526
> ---
> -- abc some description
> 3 3 4
> def something else 7
> 8 8
> etc...
> So the problem is that I cannot get the titles for the first columns,
> only the generated ones for the weeknumbers at the end. The matrix
> control has only one text field above all other columns. Obviously I
> want to show Part ID, Description, etc... there.
> I also want these column names to be visible when this report gets
> exported to a csv file.
> Does anyone know how to do these two things?
> I would really appreciate your help.
> Thanks,
> Edgar
Subscribe to:
Posts (Atom)