Example Brick setq 029

 

 

Description

These examples show the setq function set the values of a Brick using the field name and the field index.

 

Details

Create a new Brick, named X, and give it 5 rows each containing three fields. The name field contains 2 repeats, the age field contains 2 repeats, the address field contains 2 repeats.

The brick X will look like this table:

row1name1 row1name2 row1age1row1age2row1address1row1address2
row2name1 row2name2 row2age1row2age2row2address1row2address2
row3name1 row3name2 row3age1row3age2row3address1row3address2

(setq X (new Brick: 3 name:Object:2 age:Integer:2 address:Object:2)) Returns: #<Record 123456>

You can set values using indices. The first index is the field or field index, the second index is the rowNumber, and the third index is the repeatNumber of the specific field.

(setq X[name: 0 0] #("Anna") ) Returns: #<Record 123456>

The field index 2 refers to the address field.

(setq X[2 0 0] #("California") ) Returns: #<Record 123456>

We are writing on the second row.

(setq X[name: 1 0] #("Beth")) Returns: #<Record 123456>

We are writing on the second row.

(setq X[1 1 0] 18) Returns: #<Record 123456>

Notes and Hints

The brick X will now look like this table:

Anna row1name1 row1age1row1age2Californiarow1address2
Beth row2name2 18row2age2row2address1row2address2
row3name1 row3name2 row3age1row3age2row3address1row3address2

 

Related Examples

Here are examples of the setq function at work.

BitVector setq 024 Boolean setq 016 Brick setq 029 Brick setq 28
Character setq 017 Date setq 019 Dictionary setq 007 Dictionary setq 008
Dictionary setq 009 Directory setq 010 Directory setq 011 FltVector setq 019
IntVector setq 020 List setq 025 List setq 026 Matrix setq 014
NumVector setq 021 Number setq 018 ObjVector setq 022 ObjectRepository setq 027
PcodeVector setq 023 ShortVector setq 021 String setq 001 Structure setq 003
Structure setq 004 Structure setq 005 Structure setq 006 Symbol setq 001
Symbol setq 002 Vector setq 012 Vector setq 013 Void setq 015

 

Function Links

Here is the link to the current function used in this example.

setq

Here are a number of links to other related functions.

ref(Brick)

 

Argument Types

Here are the links to the data types of the arguments used in this example.

Brick

Here are a number of links to examples having similar argument types.

Brick addMethod 008 Brick cdr 010 Brick compare 019 Brick compareEQ 019
Brick compareGT 019 Brick compareLE 019 Brick compareLT 019 Brick compareNE 019
Brick comparison 019 Brick copy 012 Brick defmethod 025 Brick isAtom 011
Brick isEqual 018 Brick isIdentical 020 Brick isObject 014 Brick isType 022
Brick length 017 Brick methodsOf 024 Brick new 015 Brick ref 036
Brick send 027 Brick setCdr 014 Brick setq 029 Brick setq 28
Brick sizeof 029 Brick type 026

How do I contact the AIS Server team?

You can always talk with the AIS at aiserver.sourceforge.net.