Example Brick ref 036

 

 

Description

These examples show the ref function retrieve a value from the Brick field. The syntax for referencing is as follows: ref RecordName[ Column Repeat Row ]

 

Details

Create a new Brick, named Contestant, and give it 5 Rows each containing two Columns(Name and Score). The second column(Score) repeats 20 times for each row.

(setq Contestant (new Brick: 5 Name:Object:1 Score:Number:20)) Returns: #<Record 123456>

Sets the value of the Name field as a Vector for the first row's first repeat.

(setq Contestant[0 0 0] #("Anna Smith")) Returns: #<Record 123456>

Sets the value of the Name field as a Vector for the second row.

(setq Contestant[0 0 1] #("John Doe")) Returns: #<Record 123456>

Sets the value of the Name field as a Vector for the third row. This example uses a symbol(Name:) instead of an integer index

(setq Contestant[Name: 0 2] #("Jane Baker")) Returns: #<Record 123456>

Sets the value of the Score field for the first row and first repeat as 100.0.

(setq Contestant[1 0 0] 100.0) Returns: #<Record 123456>

Sets the value of the Score field for the first row and second repeat as 99.0.

(setq Contestant[1 1 0] 99.0) Returns: #<Record 123456>

Sets the value of the Score field for the second row and first repeat as 99.0.

(setq Contestant[1 0 1] 99.0) Returns: #<Record 123456>

Sets the value of the Score field for the second row and second repeat as 100.0.

(setq Contestant[1 1 1] 100.0) Returns: #<Record 123456>

Sets the value of the Score field for the third row and first repeat as 75.0. This example uses a symbol(Score:) instead of an integer index.

(setq Contestant[Score: 0 2] 75.0) Returns: #<Record 123456>

Sets the value of the Score field for the third row and second repeat as 75.0. This example uses a symbol(Score:) instead of an integer index.

(setq Contestant[Score: 1 2] 75.0) Returns: #<Record 123456>

Displays contents of the first Brick field on the first row and first repeat. In this example the Name field as a set Vector value.

(ref Contestant[0 0 0]) Returns: #<Vector 123456>

Displays contents of the first Brick field on the first row and first repeat. This example uses a symbol(Name:) instead of an integer index.

(ref Contestant[Name: 0 0]) Returns: #<Vector 123456>

Displays the Brick content returned by any of the previous two examples.

(display #<Vector 123456> ) Returns: #("Anna Smith" )

Displays contents of the second Brick field on the first row and first repeat.

(ref Contestant[1 0 0]) Returns: 100.0

Displays contents of the second Brick field on the first row and first repeat. This example uses a symbol(Score:) instead of an integer index.

(ref Contestant[Score: 0 0]) Returns: 100.0

Displays contents of the second Brick field on the first row and second repeat.

(ref Contestant[Score: 1 0]) Returns: 100.0

Displays contents of the second Brick field on the second row and first repeat.

(ref Contestant[Score: 0 1]) Returns: 100.0

Displays contents of the second Brick field on the third row and second repeat.

(ref Contestant[Score: 1 2]) Returns: 75.0

 

Related Examples

Here are examples of the ref function at work.

BitVector ref 027 Boolean ref 018 Brick ref 036 Date ref 020
Dictionary ref 007 Dictionary ref 008 Dictionary ref 009 Directory ref 010
Directory ref 011 Directory ref 012 FltVector ref 022 Function ref 021
IntVector ref 023 Lambda ref 017 List ref 028 Matrix ref 015
Matrix ref 016 NumMatrix ref 035 NumVector ref 024 Number ref 019
ObjVector ref 025 ObjectRepository ref 030 ObjectRepository ref 031 ObjectRepository ref 032
ObjectRepository ref 033 ObjectRepository ref 034 PcodeVector ref 026 ShortVector ref 024
String ref 001 String ref 002 Structure ref 004 Structure ref 006
Symbol ref 003 Vector ref 013 Vector ref 014 Void ref 017

 

Function Links

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

ref

Here are a number of links to other related functions.

setq(#void)

 

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

Analytic Information Server (AIS)

AIS Component Systems

  • Smartbase Engine
  • QT C++ Libraries
  • MySQL Relational Database
  • AIS Lisp Libraries
  • Rapid Analytic Demo IDE