Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2005
    Posts
    8

    Unanswered: Combining date and character

    I have 2 fields. One is Need Date and the other is Need Date Adjusted. What code would I use to have it display the date with an "A" before it in the same field if it was adjusted and just the date if it wasn't.Thanks for any help, I'm very new to this.
    Last edited by Abrown9305; 12-08-05 at 17:32.

  2. #2
    Join Date
    Oct 2005
    Posts
    178
    Are these two fields are date-format? If so keep the format because it's easier to manipulate the values if you need to later. You can't have more than one data format in a record content. I suggest you create another boolean field next to it and call it "adjustedDate". Flag it true or yes if the datefield was adjusted or false or no otherwise.

    TO display in Crystal report with prefix, you can create a formula and call it AdjustedDate and use the following argument

    "A" + ToText({tbldata.Datefield})
    Last edited by fredservillon; 12-08-05 at 17:11.

  3. #3
    Join Date
    Dec 2005
    Posts
    8
    Thanks,I just got the A in front of the date, but I can't change the date format to drop the time now because it doesn't recognize the field as a date, I think.



    stringVar a;
    if IsNull ({NEED_DATE_ADJ}) then
    a := " " & {NEEDDATE}
    else
    a := "A " & {NEED_DATE_ADJ} ;


    It appears as A 8/12/2005 12:00:00AM

    Is there a way to drop the time from that?

  4. #4
    Join Date
    Oct 2005
    Posts
    178
    Use this one then

    "A: " + ToText(DateTimeToDate({tblData.DateTimeField}))

    Another way you can do as quickly is to insert a text object and type A: and insert it infront of your datefield, then
    right click on the text object and select format text, then click on the icon opposite the suppress and write the condition to suppress it when not adjusted. This way you can still format your date field to remove the time portion. It should work faster than having formulas manipulated by crystal before displaying.
    Last edited by fredservillon; 12-09-05 at 16:31.

Posting Permissions

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