Using method in SQL statement

Tim James tjames1 at bigpond.net.au
Wed Nov 19 16:32:16 CST 2003


Then I think there may be a bug in 1.9.8 as

the method is defined as  baseobject method (sorry I should have said 
can I refer to a baseobject method in an sql statement)

and when I

"select margin from stock" (in visql and my app)


it lists the correct values

but when I

"select margin from stock where margin > 25"

I get empty cursor and no error in my app and nil records in visql
(and 90% of values are above 25)

On 19/11/2003, at 4:22 PM, Ruslan Zasukhin wrote:

> on 11/19/03 2:08 AM, Tim James at tjames1 at bigpond.net.au wrote:
>
> Hi Tim,
>
>> Is it possible to use a method field in a sql statement if the method
>> (margin is its name) is calculated as follows
>>
>> round((1-(costprice/(recretail/1.1)))*100,2)
>
> In Valentina 1.x no.
>
> This will work in 2.0
>
> For now you need to create BaseObject method with that formula
>
>
>> where recretail and costprice are double fields and method is defined
>> as double also
>>
>> I know I can use method such as Upper(surname) in sql search but are
>> there limitations on the use of calculated methods
>>
>> I can display the method field using an sql statement but apparently
>> not use it  as follows
>>
>> select margin from stock where margin > 25
>
> Why?
>
> You can                 SELECT method,
> Search on method        WHERE method > 25
> Sort on method          ORDER BY method
>
> -- 
> Best regards,
> Ruslan Zasukhin      [ I feel the need...the need for speed ]
> -------------------------------------------------------------
> e-mail: ruslan at paradigmasoft.com
> web: http://www.paradigmasoft.com
>
> To subscribe to the Valentina mail list go to:
> http://lists.macserve.net/mailman/listinfo/valentina
> -------------------------------------------------------------
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
>


More information about the Valentina mailing list