Question
Peter Smit · Jan 19

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
0
0 110
Discussion (4)1
Log in or sign up to continue

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"

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

well, in this case you may use method __setitem__ directly

do ws."__setitem__"("A1", "blah")

Thanks, that appears to work