V4RB Select Problem

Cindy Brown cindy at kowhaiprogramming.com
Mon Sep 20 11:29:14 CDT 2004


Hi Ruslan

I just reindexed the database and it seems to be fine. It seems the indexes,
which I delete regularly, were out of sync.

But then, this is my problem. I have to calculate student's ages based on a
certain date - e.g. Their age today, their age at the beginning of the year,
their age at the 1st of July. Currently I am doing this with a calculated
method which I set up as I run RealBasic (change the method based on the
date, and then calculate their ages). The following is an example:

    
app.mDatabase.BaseObject("Students").Field("Age1").SetMethod("YEAR('"+workin
gdate+"')-YEAR(Date_Of_Birth)")
    
app.mDatabase.BaseObject("Students").Field("Age2").SetMethod("MONTH('"+worki
ngdate+"')-MONTH(Date_Of_Birth)-IF(DAYOFMONTH('"+workingdate+"')-DAYOFMONTH(
Date_Of_Birth)<0,1,0)")
    
app.mDatabase.BaseObject("Students").Field("Age3").SetMethod("DAYOFMONTH('"+
workingdate+"')-DAYOFMONTH(Date_Of_Birth)")
  
I need to do this several times in a particular RB Method. The problem is
that this can then cause the indexes to go out of sync. Is there a better
way that I can be doing this?

Cindy

>> 
>> This would seem to be a bug in the Select Query if using a method. If using
>> a standard Short field, the select returns the correct amount of records. It
>> only occurs when a Method field is used. Has anybody else seen this problem?
> 
> No Cindy.
> 
> You have simple db which we can test in viSQL or Vstudio ?
> 



More information about the Valentina mailing list