If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Crystal Reports > Help - Formula

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-13-09, 12:46
FelipeSenna FelipeSenna is offline
Registered User
 
Join Date: Oct 2009
Posts: 5
Unhappy Help - Formula

Guys, I wonder if I can help make a formula. I asked in my service, but it is not my area ... .. haha ...would be the following:

Exists in the database variables Closing Date (DataEncerramento) and the Opening Date (DataInicio).

He stated that when the closing date was greater than two months of opening date will appear FL.

If the closing date is less than two months after the opening date appeared FI.

Could anyone help me? Thank you very much!

(and sorry by English)

Last edited by FelipeSenna; 10-13-09 at 12:50.
Reply With Quote
  #2 (permalink)  
Old 10-13-09, 13:38
brucevde brucevde is offline
Registered User
 
Join Date: Jan 2003
Location: British Columbia
Posts: 44
Code:
If DateAdd("m",2, {DataInicio.OpeningDate}) > {DataEncerramento.ClosingDate} Then
   "FI"
Else 
   "FL"
Reply With Quote
  #3 (permalink)  
Old 10-13-09, 14:08
FelipeSenna FelipeSenna is offline
Registered User
 
Join Date: Oct 2009
Posts: 5
Hi...thanks!

But, the system show this message: "A date-time is required here."
Reply With Quote
  #4 (permalink)  
Old 10-13-09, 14:17
brucevde brucevde is offline
Registered User
 
Join Date: Jan 2003
Location: British Columbia
Posts: 44
Your database fields are not true Date fields, they are probably String fields that happen to contain date values.

You will need to convert the database fields to Dates before you can use the DateAdd function.

The DateValue function might work for you, assuming the date values are all stored using the same format.

Last edited by brucevde; 10-13-09 at 14:20.
Reply With Quote
  #5 (permalink)  
Old 10-14-09, 07:51
FelipeSenna FelipeSenna is offline
Registered User
 
Join Date: Oct 2009
Posts: 5
Thanks by the help...

Anyone other sugestion?

Thank very much!
Reply With Quote
  #6 (permalink)  
Old 10-14-09, 08:23
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
What is your database backend? SQL Server, MySQL, Access..?
__________________
George
Twitter | Blog
Reply With Quote
  #7 (permalink)  
Old 10-14-09, 08:53
FelipeSenna FelipeSenna is offline
Registered User
 
Join Date: Oct 2009
Posts: 5
Access...

thanks
Reply With Quote
  #8 (permalink)  
Old 10-14-09, 12:02
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
I suggest you change your query in access: add an extra column:
Code:
SELECT ...
     , Iif(DateAdd("m",2, OpeningDate) > ClosingDate, "FI", "FL")
FROM   ...
__________________
George
Twitter | Blog
Reply With Quote
  #9 (permalink)  
Old 10-14-09, 12:47
FelipeSenna FelipeSenna is offline
Registered User
 
Join Date: Oct 2009
Posts: 5
Unfortunately, I can not do that.

This is a report that will be generated by a system developed for the company that I work.

Thanks!
Reply With Quote
  #10 (permalink)  
Old 10-14-09, 15:49
brucevde brucevde is offline
Registered User
 
Join Date: Jan 2003
Location: British Columbia
Posts: 44
Quote:
Anyone other sugestion?
Did you try

Code:
If DateAdd("m",2, DateValue({DataInicio.OpeningDate})) > DateValue({DataEncerramento.ClosingDate}) Then
   "FI"
Else 
   "FL"
If that doesn't work give us some more information! How are the dates stored in the database? What format?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On