MSulchan Darmawan ha scritto:
> Pada Mon, 07 Sep 2009 13:19:32 +0200
> Doriano Blengino <doriano.bleng...@fastwebnet.it> menulis:
>
>   
>>        res = db.Create("refpos")      ' append record in table named
>> refpos for i = 1 to 31
>>          res["Res" & i] = ...
>>        next
>>     
>
> Does this means the field name is Res1, Res2, ..., Res31 ???
> If so, wow this is great, I didn't know that variable names can be
> iterated.
>   
Res1, Res2... are *not* variables (or variable names), they are fields 
of a database record. The Result object takes care of getting the index 
between square brackets, which can be an arbitrary string, even a string 
expression, and operate on the corresponding record field.

This is why I omitted the right part of the assignment ("..."); in that 
place you can not do the same trick: but of course you can if you use 
there some object like another Result[] or Settings[] or objects like 
those, which can be indexed by mean of string expression.

Regards,
Doriano
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to