Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select specific data with formula 1

Status
Not open for further replies.

Oona8

Technical User
Apr 3, 2002
25
FR
Hi ,

I' d like to know if it's possible to do a selection of datas in a formula, like we can do in a report. I need to see a date (named dt_op)that corresponds to a specific event (named id_fin). the problem is that the date can correspond to other events. How can I just see the date which corresponds to id_fin? the if then else won't work as don't want any other record than these.
I use CR8, and this formula should be in a section detail of a group sorted by contract_id.
Hope it's understandable and there's a solution
cheers
 
Does it NEED to be in a formula? If not then use the select expert to "say"....

(WHERE) DATE = (formula, parameter, whatever)
AND
(WHERE) ID_FIN = X (your event)
 
Thanks but I think it should be a formula as the selection expert is not enough as it gives me more records than I should have. I've seen some kind of formula with 'record selection' and thought something like that could work, any idea about the syntax of this formula?
Cheers
 
The select expert actually writes a record selection formula behind the scenes. While you are using the select expert click on the "show formula" button.

There are some limitations as yo what you can do with the select expert, which is why I usually enter a record selection formula manually. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
ok let us start by saying that you will have to create some user entered parameters to specify the date(s) and event(s) that you want in the report.

I usually use 2 parameters for date...a StartDate and an EndDate to define the date range.

I don't know if {table.dt_op} is a date field, a date/time field, numeric field or a string field...just make certain the parameter matches the data type

Then you can have a parameter relating to {Table.id_fin} this sounds like a string field to me so you will have a string parameter for it

Your parameters will be as follows:

{?StartDate}
type: string or number or date or date/time (choose one)
Description: Enter the Start date for the report
default value: (none entered)

{?EndDate}
type: string or number or date or date/time (choose one)
Description: Enter the End date for the report
default value: (none entered)

{?Event}
Type: String
Description: Enter the the specific Event ID or "ALL" for
all Event ID's
Default: ALL

now go directly to the Record Select Formula...ignore the Select Expert and type in the following formula

{table.dt_op} >= {?StartDate} and
{table.dt_op} <= {?EndDate} and
(if uppercase({?Event}) <> &quot;ALL&quot; then
{table.id_fin} = {?Event}
else
True;)

That should do it for you....only one note of caution...if the date is in string or numeric format in the database hopefully it will be in the format yyyymmdd otherwise this will not sort well and you should convert it to a date...it will take longer to process...but...nothing you can do.

Hope this works for you

JimBroadbent@Hotmail.com

Reward good advice with a star, it reinforces us and helps others find answers to their problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top