CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2017
    Posts
    2

    Returning a Card number

    Hi,
    I am trying to write the formula to return a users medical card number for example on the system they are recorded as having a start date and end date.
    I want to able to display all values that are active as of the users admission date. so for example if user was admitted on
    01/01/2012 I want to display what medical card was active at that time/date. I have the following code so far but I am running into trouble.
    Also the end date may contain nulls. so it will always have a start date but not always a future end date.

    I have something like this so far but im probably way off

    if {USER_IDS.TYPE_REFNO}=1051 and {USER_IDS.STATUS_REFNO}=1542
    and not isnull({USER_IDS.END_DTTM}) and {USER_IDS.END_DTTM}>=CurrentDate
    then {USER_IDS.IDENTIFIER}
    else 'No Medical Card'

    Any help be madly appreciated
    Crystal reports version 11.5.3

  2. #2
    Join Date
    Aug 2007
    Posts
    179

    Re: Returning a Card number

    I don't think there is enough info here to really provide an answer. First - what is the "trouble" you are running into? is there an error message, or is the output just not what is expected?

    My initial observation is you have four different criteria your are testing for, but only one result path. You may want to break this into logical chunks,
    Code:
    if {USER_IDS.TYPE_REFNO}=1051 then
    	if {USER_IDS.STATUS_REFNO}=1542 then
    		if not isnull({USER_IDS.END_DTTM}) then
    			if {USER_IDS.END_DTTM}>=CurrentDate then
    				{USER_IDS.IDENTIFIER} 
    			else
    				What to do if date is less than current date?
    		else 
    			what to do if date is null
    	else
    		what to do if status_refno <> 1542
    then
    	what to do if type_refno <> 1051

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured