V4MD Info about setBlank()

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Oct 6 23:09:47 CDT 2005


On 10/6/05 10:56 PM, "info at vallemediatime.com" <info at vallemediatime.com>
wrote:

> Hi list,
> I need to better understand the use of Table.setBlank method
> 
> I've tried this:
> 
> on CreateTable_Person
>   Person = gDb.createTable("Person")
>   Person.createUShortField("fPerson_ID", [#fUnique])
>   Person.createStringField("fPerson_Name", 20)
>   Person.createByteField("fPersonType_Ref")
> end
> 
> on AddRecordsTo_Person
>   Person = gDb.table(Person)
>   fPerson_ID = Person.field("fPerson_ID")
>   fPerson_Name = Person.field("fPerson_Name")
>   fPersonType_Ref = Person.field("fPersonType_Ref")
>   curTable.setBlank()
>   curTable.addRecord()
> end
> 
> When I add a record I want to set all Person.fields to EMPTY... is this
> script right or is better someother code?

Of course it will be empty! :-)

Look what you do:

1) you enter new values for fields
>   Person = gDb.table(Person)
>   fPerson_ID = Person.field("fPerson_ID")
>   fPerson_Name = Person.field("fPerson_Name")
>   fPersonType_Ref = Person.field("fPersonType_Ref")

2) then you do SetBlank()

    OOOOOOOOOOPS 

You have erase all your new values !

The correct code is:

--------------------------------------
on AddRecordsTo_Person

   Person = gDb.table(Person)

   Person.setBlank()

       fPerson_ID = Person.field("fPerson_ID")
       fPerson_Name = Person.field("fPerson_Name")
       fPersonType_Ref = Person.field("fPersonType_Ref")
 
  curTable.addRecord()

end
--------------------------------------

Wait wait wait wait.

Paolo, you have even double mistake.

       fPerson_ID = Person.field("fPerson_ID")
       fPerson_Name = Person.field("fPerson_Name")
       fPersonType_Ref = Person.field("fPersonType_Ref")

This only give you fields. But I do not se any line to add new values.


-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list