Logic Machine Forum
Is it possible to change the plane of a page? - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Is it possible to change the plane of a page? (/showthread.php?tid=2596)



Is it possible to change the plane of a page? - Carlos Padilla - 16.04.2020

Hello colleagues, I hope you are excellent. I am writing to you because I would like to know if it is possible, either by script or something, to have a kind of listing of all the pages with respective IDs (scada-vis / # xxx) of the plans. On the other hand, I would also like to know if it is possible that I can change these "IDs" and assign another number of pages. I say the above because I have several logic machines with some users and each user is changed by code, username, password and the pages they are allowed to see. The problem is that recently I was asked to add some pages, which I have to add in the other logic machines and their plans will change, so my idea is to change the plan so that I do not have to modify the code of each one separately, which can make me have problems.

Thank you and I will be attentive to your comments.


RE: Is it possible to change the plane of a page? - Erwin van der Zwart - 16.04.2020

Hi,

You cannot change the plan ID as it is related to the DB ID that is auto created when the plan, layout or widget is created, the objects on a page are also linked to this ID so changing the ID would result in missing references from visobjects on the page. If you create a plan this will get ID1, when creating a layout after that is will get ID2, adding another plan will get ID3 and adding a widget will get ID4, if you delete the first plan and recreate it it will get ID5 and ID1 will not exist anymore.

To get a list with ID's you can use this command:
Code:
result = db:getall('SELECT id, name, type FROM visfloors')
log(result)
A plan has no type (null) in the DB, otherwise type is layout or widget.

BR,

Erwin


RE: Is it possible to change the plane of a page? - Carlos Padilla - 16.04.2020

Okay. Thanks, what I can do is try to make everyone parallel on the plans they want to add. The problem is that I am running that code and it only shows it to page 585 in some, in others 590 and so on, but if I go and check the plans in the preview editor, the last ones I added have 880, 890 and so on, I mean, you're not showing me all the plans. Why is this happening?


RE: Is it possible to change the plane of a page? - Erwin van der Zwart - 16.04.2020

Okay lots of plans there..

The log probably ends with ... meaning its reached it max chars, the table is probably longer but log does not show all..

Can you try this:
Code:
result = db:getall('SELECT id, name, type FROM visfloors')
for key, value in ipairs(result) do
  if value.type == 'layout' then
    log('layout: ' .. value.name .. ' is having id: ' .. value.id)
  elseif value.type == 'widget' then
    log('widget: ' .. value.name .. ' is having id: ' .. value.id)
  else
    log('plan: ' .. value.name .. ' is having id: ' .. value.id)
  end
end
BR,

Erwin