Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Problem with Post Reply Post New Topic
Author Message
dawnh44
Groupie
Groupie


Joined: 25 Sep 2011
Online Status: Offline
Posts: 79
Quote dawnh44 Replybullet Topic: Problem with
     Posted: 28 Nov 2011 at 8:47am
Hello everyone,
 
I'm having a problem with the following formula:
(If {?month} in [1,7] then
    if {S_DOC_AGREE.ATTRIB_39} = 'Semi-Annually' then
        {@month} in [1,7] else
    {?month} = {@month}
else if {?month} in [2,8] then
    if {S_DOC_AGREE.ATTRIB_39} = 'Semi-Annually' then
        {@month} in [2,8] else
    {?month} = {@month}
else if {?month} in [3,9] then
    if {S_DOC_AGREE.ATTRIB_39} = 'Semi-Annually' then
        {@month} in [3,9] else
   {?month} = {@month}
else if {?month} in [4,10] then
    if {S_DOC_AGREE.ATTRIB_39} = 'Semi-Annually' then
        {@month} in [4, 10] else
   {?month} = {@month}
else if {?month} in [5, 11] then
    if {S_DOC_AGREE.ATTRIB_39} = 'Semi-Annually' then
        {@month} in [5, 11] else
   {?month} = {@month}
else if {?month} in [6, 12] then
    if {S_DOC_AGREE.ATTRIB_39} = 'Semi-Annually' then
        {@month} in [6, 12] else
    {?month} = {@month}) and
year(date({S_DOC_AGREE.EFF_START_DT})) & month(date({S_DOC_AGREE.EFF_START_DT})) <> {?year} & {?month}
and {S_DOC_AGREE.NAME} in ['Accuray%','Michael Best%','Alyeska%','Acuity%'] = {S_DOC_AGREE.NAME}+ 'Nurse Navigator' 
 
The last part of the formula is not working.  I'm want it to look for Accuray, Michael Best, Alyeska and Acuity.  When the formula finds these names, I would like the name plus "Nurse Navigator to print with the name.  Any help would be greatly appreciated.
 
Thank you in advance.
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Nov 2011 at 10:38am
not exactly sure what your entire process is because you can't use if-then statements to assign a value to an exisiting field but maybe this will help you,
crystal syntax uses * rather than % for the wildcard.
 
{S_DOC_AGREE.NAME} LIKE ['Accuray*','Michael Best*','Alyeska*','Acuity*']
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 28 Nov 2011 at 1:24pm
I would think that 'then {@month} in [x,xx] should be either and IF or AND since the phrase makes no sense as it stands.  In addition, the assignment operator is := not = which is the comparator operator.
 
Could also use an INSTR instead of LIKE but it would take more room (the like is more elegant)
IP IP Logged
dawnh44
Groupie
Groupie


Joined: 25 Sep 2011
Online Status: Offline
Posts: 79
Quote dawnh44 Replybullet Posted: 01 Dec 2011 at 5:24am
Hello again,
 
Thank you for your suggestions.  I'm still having a problem with the formula.  What I'm trying to accomplish is when you see Accuray, Michael Best, Alyeska or Acuity in the report, then I would like the words Nurse Navigator added to the name.  An example is the following:
 
Accuray (Nurse Navigator)
Michael Best (Nurse Navigator)
Alyeska (Nurse Navigator)
Acuitiy (Nurse Navigator)
 
I've updated the code:
 
(If {?month} in [1,7] then
    if {S_DOC_AGREE.ATTRIB_39} = 'Semi-Annually' then
        {@month} in [1,7] else
    {?month} = {@month}
else if {?month} in [2,8] then
    if {S_DOC_AGREE.ATTRIB_39} = 'Semi-Annually' then
        {@month} in [2,8] else
    {?month} = {@month}
else if {?month} in [3,9] then
    if {S_DOC_AGREE.ATTRIB_39} = 'Semi-Annually' then
        {@month} in [3,9] else
   {?month} = {@month}
else if {?month} in [4,10] then
    if {S_DOC_AGREE.ATTRIB_39} = 'Semi-Annually' then
        {@month} in [4, 10] else
   {?month} = {@month}
else if {?month} in [5, 11] then
    if {S_DOC_AGREE.ATTRIB_39} = 'Semi-Annually' then
        {@month} in [5, 11] else
   {?month} = {@month}
else if {?month} in [6, 12] then
    if {S_DOC_AGREE.ATTRIB_39} = 'Semi-Annually' then
        {@month} in [6, 12] else
    {?month} = {@month}) and
year(date({S_DOC_AGREE.EFF_START_DT})) & month(date({S_DOC_AGREE.EFF_START_DT})) <> {?year} & {?month}
and  {S_DOC_AGREE.NAME} like ['Accuray*','Acuity*','Alyeska*','Michael Best*'] then
{S_DOC_AGREE.NAME}+''+'Nurse Navigator'
 
I'm still receiving errors.  Any suggestions would be appreciated.
 
Thank you in advance.
IP IP Logged
dawnh44
Groupie
Groupie


Joined: 25 Sep 2011
Online Status: Offline
Posts: 79
Quote dawnh44 Replybullet Posted: 01 Dec 2011 at 5:40am
Hello again everyone,
 
I figured this out for myself.  I don't know why I made this harder than it really was.  I just added the following formula:
if {S_DOC_AGREE.NAME} like ['Accuray*','Acuity*','Alyeska*','Michael Best*'] then
{S_DOC_AGREE.NAME}+'(Nurse Navigator)'
else {S_DOC_AGREE.NAME}
 
I've called this Group_Name, and I added it to the report.  It works perfectly.
 
Thank you.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 01 Dec 2011 at 5:44am
If {?month} in [1,7] then
    if {S_DOC_AGREE.ATTRIB_39} = 'Semi-Annually' then
         {@month} in [1,7]
    else
        {?month} = {@month}
what DBlank and I are saying is that this makes no sense.
DBlank states that you can't change the parameter, which makes sense as that would change the values in the recordset.
In addition, this "{?month} = {@month}" doesn't do anything, it returns true or false, as you are not assigning a value, but comparing values.  := is the assignment operator
 
the first part of the 2nd if " {@month} in [1,7] "  doesn't assign anything, and what exactly are you intending?  You can't assign a value between 1 and 7, so it is confusing.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 01 Dec 2011 at 10:57am
glad to hear it, much simpler
 
don't you just hate when you overthink a solution ;)


Edited by lockwelle - 01 Dec 2011 at 10:58am
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