PDA

View Full Version : writing specific criterria instruction


Lee Carson
7th November 2004, 02:46.35 PM
As all can see by my Atavar, I am taking a beating at the moment, so the sticking point for me, is this query thing. Where is the glossery for types of fields and matching query "styles" Reading all the posts helps a great deal but one must inquire for any "shortcuts" info out there. For example, I have some expr fields (vaild, by Mike Dee) and have no clue as to how to get anything out of them due to query-speak
Lee

Rick
7th November 2004, 03:19.39 PM
I take them as they come so I can't give you a blanket answere about how to do it. Figure out what you are trying to get and then enter the criteria.

From what I have seen in Access books you should be able to find a page or two that shows how to enter criteria and how to use wildcards.

If you give an example of what you are having trouble with, I or someone else can give examples of how to do what you are trying to do, or explain why we can't.

Donnie
7th November 2004, 06:02.40 PM
Lee,
An expr field is nothing but a calculation put into a field box in the query grid. The first part is what is called an alias, the name the new column will be called. Hence myrating:[nHTR]+[nTRN] would result in a new field called myrating and the data in that field would contain each horse's HTR number added to each horse's trainer number. These expressions can be as simple or as complex as a person wants it to be. Now to "get something" out of this field as you questioned, all you need to do is put your defining criteria in the criteria row. Suppose you want to only see horses with a total in this column who's combined score (or more so, thier myrating) is greater than 400, then put >400 in the criteria row under this field. At first queries seem daunting, but once you write a few of them they get easier and easier. As Rick suggested, post what you are looking for and others here will help you write it properly.

Lee Carson
9th November 2004, 11:41.31 AM
Ok, I am getting nowhere with defining queries - here's a simple example: I want to know the win pct of one field called : "Q Max Horse Pac" for all the tracks I am testing. This is what I entered for three specific criteria:
Field Xwin = 1
Field Trk:tTrk="all"
Field Q Max Hse Pac:nt=>90

And by running thd ROI REPORT = errors all the way. 'What am I omitting? doing wrong? and why?
Thanks for the help in advance
Lee

Rick
9th November 2004, 12:04.57 PM
First xWin = 1 is a bad criteria. For 2 reasons. First you want xFIN if you are going to do something like that. 2nd you don't need either xWin or xFIN for the query.

The report uses xFIN.

What is Field Q Max Hse Pac:nt=>90

I look at it and it looks like you are trying to create an expression but what I don't understand.

I would create the field Q Max Hse Pac and then enter on the criter line >=90 save query and then run the report.

You can email me a copy of your query in SQL View and I will take a look at it. Also explain how you are creating your expression.

Rick
9th November 2004, 02:22.23 PM
Lee,

You need to ask yourself basically what you are looking for and what you need to do to get the results you want.

If you want to find how the top FR1 horse in the race does, km has made it easy because the FR1 is ranked. All you have to do is enter 1 in the criteria line for rFR1, save your query and run the report.

Most fields that are exported as a value, like nPER, have a rank associated with them. It can get tricky if you have a value field that does not have a ranking.

If you create your own value field, if you let me know how you created the field and explain what you are trying to query I can probably duplicate what you are trying to do in my database and give you an answer.

Most of the queries are pretty simple; once you get a feel for them.

I get an idea of what I want to do and jump in and give it a try. If I don't get the results I expected I just try to figure out what I am doing wrong and try again.

Of course I have been doing this a few years now and have experienced most of the problems you are running into and have either figured out my way around them or got help from someone else.

And many times I just give it a rest and come back to it in a day or two.

I have a much easier time figureing out queries when I can play with them live. :D

Lee Carson
10th November 2004, 11:22.00 AM
Thanks to all - and especially to mike for his email - Is there anything that represents a query glossery for everything from HX3 - HX7, (without being redundant) AND is this another silly suggestion on my part or would it become a useful reference for the Manual?
Lee

MikeDee
10th November 2004, 11:44.24 AM
There is no reference like the one you mentioned that I know of. Just keep in mind, that you can query on any field in your table. You have to specfiy the critera for a field in accordance with the data type of the field.

For example in a number field you can use >, <, = , and so on to filter out numbers of a specific range.

In text fields you can use "like" in combination with a "*" to find text strings or part of text strings. For example you could say like *xyz to find any text that ends in xyz. On the other hand like *xyz* would find xyz anywhere in a string of text

in data fields you can use >,<,= to find a range of dates for example >=01/01/04 to find all races in 2004 in your db.

You can use a value of one field to filter for a value in another filed. For example if you wanted to find all horses with a nper value >= todays nepr
you can put the following in the criteria row for the per field
>=nepr.

There are so many different ways you can write critera the best thing to do is when you get stumped, jusr ask here on the board how to write the criteria for what you are trying to do. I'm sure you will multiple good ideas on how to go about it.

ggpagels
10th November 2004, 01:13.06 PM
Lee- Look at the post I just made to the News from KM/November thread in the General Discussion Forum. It shows the criteria and fields I used for a backtest on F1v #2 ranked horses. It might help you. :)