Question to Methods

Claudius Sailer Claudius at sailer-online.de
Tue Feb 24 19:41:44 CST 2004


Am 24. Feb 2004 um 19:33 Uhr schrieb Claudius Sailer:

> Hi Ruslan,
>
>
> Am 24. Feb 2004 um 09:27 Uhr schrieb Ruslan Zasukhin:
>
>> In the V4RB Examples folder present example "Methods".
>
> Sorry this can't help
>
>   StringUprFld = new VString( "stringUpr_fld", 30 )
>   StringUprFld.SetMethod( "Upper(string_fld)" )
>
> but I am using
>
> Classes for every Table
>
> Sub DBCurrencies(inDatabase as Datenbank)
>   name="Currencies"
>   CUR=new VVarChar("CUR",504,ValLang,kV_Unique +kV_Indexed)
>   CURName=new VVarChar("CURName",504, ValLang,kV_Unique +kV_Indexed)
>   Ric=new VVarChar("Ric",504,ValLang,kV_Indexed+kV_Nullable)
>   Online=new VObjectPtr("Online",inDataBase.TOnline,kV_Nullable +  
> kV_Restrict)
>   LastValue=new VLong("LastValue",kV_Nullable)
>   QuotationUnit=new VULong("QuotationUnit")
>   QuotationMode=new VBoolean("QuotationMode")
>   NValue=new VFloat("NValue","if(QuotationMode=1,  
> LastValue/QuotationUnit, 1/(LastValue/QuotationUnit)"))
>   Sortierung=new VULong("Sortierung")
> end sub
>
>> Constructor of Vfloat have last parameter AS STRING.
>> So syntax must be
>>
>>  NValue=new VFloat("NValue",
>>    
>> "if(QuotationMode=1,LastValue/QuotationUnit,1/(LastValue/ 
>> QuotationUnit)"))
>
> This brings SyntaxError. I tested several things with brackets, but I  
> got always Syntax Error.

Okay, now I have it.

I defined the NValue=new VFloat("NValue") inside of the table-class and  
in the database Class I defined after the tabledefinition

   TCurrencies=new DBCurrencies(self)
    
TCurrencies.NValue.SetMethod("if(QuotationMode=1,LastValue/ 
QuotationUnit,1/(LastValue/QuotationUnit))")

Now I don't get an error message again.

Thanks for help


Claudius



More information about the Valentina mailing list