Conditional calc on the same field in QBE 
Author Message
 Conditional calc on the same field in QBE


Quote:
>Does anyone know if there is a way to use the calc function in QBE to generate
>a new field in the answer table whose value is based conditionally on the
>contents of an existing field in a table.  Specifically, what I am trying to
>do is create a new field in the answer table called Quarter based on the
>contents of the field Date in the current table.  However, I want to put
>different values in the answer table depending on the contents of Date.  For
>example, if Date is between 1/1/93 and 4/1/93 I want Quarter to be 1, if Date
>is between 4/1/93 and 7/1/93 I want Quarter to be 2, and so on.  

>|Date                                                                  |
>|>=1/1/93, <4/1/93, calc 1 as Quarter|
>|>=4/1/93, <7/1/93, calc 2 as Quarter|

>This produced a message from Paradox that the Query appears to ask unrelated
>questions.

This works for me in both DOS and Windows if I check the Date field.
--

Hugs and backrubs -- I break Rule 6
Androgynous {*filter*} vanilla {*filter*} het

Hmmmm.... time to get some more Astroglide.



Wed, 21 Aug 1996 01:08:57 GMT
 Conditional calc on the same field in QBE

Does anyone know if there is a way to use the calc function in QBE to generate
a new field in the answer table whose value is based conditionally on the
contents of an existing field in a table.  Specifically, what I am trying to
do is create a new field in the answer table called Quarter based on the
contents of the field Date in the current table.  However, I want to put
different values in the answer table depending on the contents of Date.  For
example, if Date is between 1/1/93 and 4/1/93 I want Quarter to be 1, if Date
is between 4/1/93 and 7/1/93 I want Quarter to be 2, and so on.  I tried both
of the following in my QBE, but neither worked.

|Date                                                     |
|>=1/1/93 and <4/1/93, calc 1 as Quarter,>=4/1/93 and <7/1/93, calc 2 as
Quarter|

This produced some type of syntax error message, so I tried

|Date                                                                  |
|>=1/1/93, <4/1/93, calc 1 as Quarter|
|>=4/1/93, <7/1/93, calc 2 as Quarter|

This produced a message from Paradox that the Query appears to ask unrelated
questions.

In addition to these examples, I tried several variations using
parenthesis, and example elements.  Any ideas/help would be greatly
appreciated.

Chris Addicks
Georgia Tech Research Institute

My opinions expressed here are my own, thank you!



Sun, 18 Aug 1996 19:02:23 GMT
 Conditional calc on the same field in QBE

Quote:

>Does anyone know if there is a way to use the calc function in QBE to generate
>a new field in the answer table whose value is based conditionally on the
>contents of an existing field in a table.  Specifically, what I am trying to
>do is create a new field in the answer table called Quarter based on the
>contents of the field Date in the current table.  However, I want to put
>different values in the answer table depending on the contents of Date.  For
>example, if Date is between 1/1/93 and 4/1/93 I want Quarter to be 1, if Date
>is between 4/1/93 and 7/1/93 I want Quarter to be 2, and so on.  I tried both
>of the following in my QBE, but neither worked.

Use multiple lines in the query.
|Date                                                              |
|>=1/1/93,<4/1/93, calc 1 as Quarter        |
|>=4/1/93,<7/1/93, calc 2 as Quarter        |
|>=7/1/93,<10/1/93, calc 3 as Quarter      |
|>=10/1/93,<=12/31/93,calc 4 as Quarter|

check marks have to be the same on all four lines

If I were doing it I would use scan in a script.

Charlie



Sat, 07 Sep 1996 23:18:59 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Conditional calc in QBE on same field?

2. QBE CALC problems

3. CALC problems with QBE in Paradox 9

4. Strange results from a QBE CALC in OBPAL

5. Lookup Fields and Calc Fields

6. DBLookupCombo with Calc Field for key field

7. calc fields in master from detailed fields

8. Calc As in Time fields only creates a Number field Ver 5

9. Calc Field-Changing Field Type

10. WIN: Updating table field from calc field

11. Converting calc field to text field w/o losing data

12. Webpage won't show text field but will show calc of text field


 
Powered by phpBB® Forum Software