Question: Can a Data Table be used as an input in a procedure?

I am trying to input data via a data table. Have several problems here.

I used an array because I want the row and column numbers to start at 0.

1st When the table appers after that the document runs hediously slow as in a second or two to enter a digit or letters appear after typing.  Like something is absorbing the computer resources. But I have a fast machine.

2nd Any data I  enter to the table vanishes but does get stored.

3rd I tried to turn it all into a procedure but cant get that to work.
 

restart

with(DocumentTools:-Components)

[Button, CheckBox, CodeEditRegion, ComboBox, DataTable, Dial, Label, ListBox, MathContainer, Meter, Microphone, Plot, RadioButton, RotaryGauge, Shortcut, Slider, Speaker, State, TextArea, ToggleButton, VideoPlayer, VolumeGauge]

(1)

with(DocumentTools:-Layout)

[Cell, Column, DocumentBlock, Equation, Font, Group, Image, InlinePlot, Input, Output, Row, Section, Table, Textfield, Title, Worksheet]

(2)

with(DocumentTools)

[AddIcon, AddPalette, AddPaletteEntry, Components, ContentToString, CreateTask, Do, GetDocumentProperty, GetProperty, InsertContent, InsertTask, Layout, RemovePalette, RemovePaletteEntry, RemoveTask, Retrieve, RunWorksheet, SetDocumentProperty, SetProperty, Tabulate]

(3)

ary := Array(0 .. 3, 0 .. 3)

Array(%id = 18446746457454449478)

(4)

``

 

 

``

DT := DataTable(identity = "DataTable0", variable = 'ary', rowheader, columnheader, columnnames = [beta^0, beta, beta^2, beta^3], rownames = [alpha^0, alpha, alpha^2, alpha^3])

xml := Worksheet(Group(Input(Textfield(DT))))

DocumentTools:-InsertContent(xml)

PN1 := copy(ary, 0 .. (), 0 .. ())

Array(%id = 18446746457454471998)

(5)

Matrix(PN1)

Matrix(%id = 18446746457454477550)

(6)

PN1[0, 0]

6

(7)

BiPolyNum := proc (a := 4, b := 4) local ary, DT; description "Creates Bi Polynumbers"; ary := Array(0 .. a, 0 .. b); DT := DataTable(identity = "DataTable0", variable = 'ary', rowheader, columnheader, columnnames = [1, beta, beta^2, beta^3], rownames = [1, alpha, alpha^2, alpha^3]); DocumentTools:-InsertContent(xml); return copy(ary) end proc

proc (a := 4, b := 4) local ary, DT; description "Creates Bi Polynumbers"; ary := Array(0 .. a, 0 .. b); DT := DocumentTools:-Components:-DataTable(identity = "DataTable0", variable = 'ary', rowheader, columnheader, columnnames = [1, beta, beta^2, beta^3], rownames = [1, alpha, alpha^2, alpha^3]); DocumentTools:-InsertContent(xml); return copy(ary) end proc

(8)

``

``

f := BiPolyNum()

Array(%id = 18446746457454464046)

(9)

f

Array(%id = 18446746457454464046)

(10)

Matrix(f)

Matrix(%id = 18446746457454466582)

(11)

``


 

Download DataTable_Experiment.mw

Please Wait...