But I want to do it a little different as this rigid address structure does not suit me, and I am too lazy to create all widgets and then modify them by script. I want to let the script create everything for me.
I think I may have a plan ready, but I am missing one thing; is there a command for making a copy of a widget? I need to do that in the beginning of the script to have anything to add items to.
There are 10 kinds of people in the world; those who can read binary and those who don't
25.10.2019, 07:42 (This post was last modified: 25.10.2019, 08:14 by Trond Hoyem.)
(25.10.2019, 07:03)admin Wrote: You can create a copy of plan/widget like this:
Code:
12345
oldid = 123item = db:getrow('SELECT * FROM visfloors WHERE id=?', oldid)
item.id = nildb:insert('visfloors', item)
newid = db:getlastautoid()
Great!
Will try that.
OK, this part is working. But to be able to add stuff to the widget I need to enter the position of each item. I tried to log the items on a widget to see what information I couldt get. A typical object gave me;
lageWidgets 25.10.2019 10:10:14
* table:
["object"]
* number: 65794
["id"]
* number: 3
["type"]
* number: 1
["name"]
* string:
["statusobject"]
* number: 65794
But I would need to have all the properties that we find in the visu-creation interface. Is there anywhere I can read up on this to find what I am looking for?
There are 10 kinds of people in the world; those who can read binary and those who don't
(25.10.2019, 07:03)admin Wrote: You can create a copy of plan/widget like this:
Code:
12345
oldid = 123item = db:getrow('SELECT * FROM visfloors WHERE id=?', oldid)
item.id = nildb:insert('visfloors', item)
newid = db:getlastautoid()
Great!
Will try that.
OK, this part is working. But to be able to add stuff to the widget I need to enter the position of each item. I tried to log the items on a widget to see what information I couldt get. A typical object gave me;
lageWidgets 25.10.2019 10:10:14
* table:
["object"]
* number: 65794
["id"]
* number: 3
["type"]
* number: 1
["name"]
* string:
["statusobject"]
* number: 65794
But I would need to have all the properties that we find in the visu-creation interface. Is there anywhere I can read up on this to find what I am looking for?
Never mind last post. I found it. I had some limitations in my SQL select, so without that, every parameter came in tho log.
There are 10 kinds of people in the world; those who can read binary and those who don't
I am facing a problem here. I have created a script that is adding widgets to the visu, and adding labels and objects to the widgets based on my object list. I have done it all on an older SpaceLYnk I had in my office, and everything worked fine.
Now I have copied the script to a newer SL at a project and am running the script. But on this SL the widgets are created, but no labels or objects are added to the widgets.
To insert the widget I greate a table with all properties of the widget and then use the following;
Code:
1
db:insert('visfloors', widget)
widget being the table with properties. This part works.
When adding labels and objects I also create a table and add it like this;
Code:
1
db:insert('visobjects', element)
I have logged the tables, and they have the right values as far as I can see, but the elements are not added to the database. Has there been a change in this for the newer HW version. I am running FW 2.3.0 on both the new and the old SL that I have tested the script.
There are 10 kinds of people in the world; those who can read binary and those who don't
25.11.2019, 14:45 (This post was last modified: 25.11.2019, 15:08 by Trond Hoyem.)
(25.11.2019, 14:29)admin Wrote: Have you assigned floor value for elements to new floor id? Also try logging return values of insert statement, it might show where the error is.
Yes, when I log the table, I have floor value, but when I log the visobjects with last floor value, the table is empty.
One other thing I can see; when I create the table I have a line stating element.id = nil to get an automatic ID, but when I log the table this line is not included. Maybe this is the problem? I should maybe get a line in the table like:
[id]
* nil
(25.11.2019, 14:29)admin Wrote: Have you assigned floor value for elements to new floor id? Also try logging return values of insert statement, it might show where the error is.
I tested the logging of the last entered element in the old and the new SL, and in the old one I get a table in return, but not in the new one.
The script is copied from the old to the new.
There are 10 kinds of people in the world; those who can read binary and those who don't
As for nil keys: setting table key to nil deletes the key, accessing non-existing keys return nil.
OK, this did it. In my table I had a line for PIN code, and apparantly that is no longer a coloumn in the Visobjects table. It did work on the old HW, but not the new one. Has this changed in a way?
I removed the line with PIN code as I am not using it anyway, so now the script works.
There are 10 kinds of people in the world; those who can read binary and those who don't