Written by

Huge Software
Question Peter Smit · Jan 19, 2023

Dictionary properties for python objects in objectscript

What would be the syntax for something like this

ws['A1'] = "blah"

I did try

set ws("A1") = "blah"

however that didn't work

Product version: IRIS 2022.1

Comments

Dmitry Maslennikov · Jan 19, 2023

Could you explain a bit more, about what do you you want to achieve?

set ws("A1") = "blah"

is just multilevel variable

if you have object in ws, with field A1, than 

set ws.A1 = "blah"

or 

set $property(ws, "A1") = "blah"
0
Peter Smit  Jan 19, 2023 to Dmitry Maslennikov

Using an excel python library inside objectscript (openpyxl)

This is an example from the documentation on this library

>>> wb = Workbook()
>>> ws = wb.active
>>> # set date using a Python datetime
>>> ws['A1'] = datetime.datetime(2010, 7, 21)

What i want to know is how to do the syntax on the 4th line in objectscript

0
Dmitry Maslennikov  Jan 19, 2023 to Peter Smit

well, in this case you may use method __setitem__ directly

do ws."__setitem__"("A1", "blah")
0
Peter Smit  Jan 19, 2023 to Dmitry Maslennikov

Thanks, that appears to work

0