This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Is it possible to change the plane of a page?
#1
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.
Reply
#2
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
Reply
#3
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?
Reply
#4
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
Reply


Forum Jump: