cancel
Showing results for 
Search instead for 
Did you mean: 

Create Alert prompt for expiry date less than 30days from current date

Former Member
0 Kudos

Hi,

I got a field due_date, what formula should I use to create a alert which will prompt out and tell me my product will expiry with 30days.

if {abc.due_date} < 30 from CurrentDate

then ???

I tried to search from interent but it is not easy to find a tutorial on creating alert in crystal report.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

fritzfeltus
Product and Topic Expert
Product and Topic Expert
0 Kudos

This should be the condition formula for your alert:

{table.date} - currentdate < 30

Cheers,

Fritz

Answers (1)

Answers (1)

Former Member
0 Kudos

It might not be easy to find it online though it is pretty easy to find it within crystal report help file.

Crystal syntax:

If IsAlertEnabled("myAlert") Then
     AlertMessage("myAlert")
Else
     "myAlert is disabled"

hope this helps

Oh and if you want to find the resource, look for Report Alert within Crystal Help file.

Kind Regards

Jehanzeb

Former Member
0 Kudos

Hi Jehanzeb,

Thanks for prompt reply.

I tried your syntax but it has an error,

I tried

If due_date< 30

Then

AlertMessage("myAlert")

Else

"myAlert is disabled" as well

I am using Crystal Report 8.5.

Former Member
0 Kudos

Could you please let me know what kind of error did you get? though the code was given as an example and not as an exact code:-).

Did you type in "due_date"? or did you double clicked it from the db? It could be that crystal didn't read or recognize the field you referred to.

Crystal Report Report Alert Example (extracted from crystal help file)

Creating Report Alerts

You must complete three steps when creating a Report Alert:

1: Name the alert.

2: Define the condition that triggers the alert.

3: Create the message you want to appear when the alert is triggered (this step is optional).

To create a Report Alert

On the Report menu, point to Alerts and then click Create or Modify Alerts.

The Create Alerts dialog box appears.

Click New.

The Create Alert dialog box appears.

Enter a name for your new alert in the Name box.

Enter your alert message in the Message box.

The Message box lets you enter a message to be used as a default. If you want the same message to appear every time your alert is triggered, enter it in the Message box.

If, however, you want to use a formula so the message is customized with data elements, see the next step.

If you want to use a formula to create an alert message, click the formula button to the right of Message.

The Formula Workshop appears. For information on how to use the editor, see Working with the Formula Editor.

Enter your alert message formula.

For example, if you want to see the message "Country is a star performer" (where Country is the name of a specific country), you might create the following formula:

+({Customer.Country}) + " is a star performer"+

Note:

The result of an alert message formula must be a string.

The DefaultAttribute function can be used to refer to a message added in the Message box. For example, if the message in your Message box is " is a star performer," your alert message formula might be:

+({Customer.Country}) + DefaultAttribute+

This formula relies on the text you enter in the Message box; that text becomes the DefaultAttribute.

+Note: Message condition formulas can be created using either Crystal Syntax or Basic Syntax.+

Click Save and close to return to the Create Alert dialog box.

In the Create Alert dialog box, click Condition.

The Formula Workshop appears.

Enter your alert condition formula.

Alert formulas can be based on recurring records or on summary fields, but cannot be based on print-time fields, such as running totals or print time formulas. Alert formulas cannot have shared variables.

If an alert formula is based on a summary field, any recurring fields used must be constant over the summary field. For example, if you are grouping on Country and Region, you might create an alert such as:

Sum ({Customer.Last Year's Sales}, {Customer.Region}) > 10000

In this case, your formula can refer to either Country or Region, but not City or Customer Name since these are not constant.

Note: Alert condition formulas can be created using either Crystal Syntax or Basic Syntax.

Clear the Enable check box if you do not want the alert to be evaluated.

Otherwise, leave it selected.

Click OK to save your alert.

You are returned to the Create Alerts dialog box and your new alert is listed. You can see its name and status (Enabled or Disabled).

Only enabled and disabled alerts appear in the Create Alerts dialog box. If an alert is triggered, it is seen in the Report Alerts dialog box.

Hope this helps

Regards

Jehanzeb