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.

Run query
#1
Hi,

how can I successfully run such query on LM? I don't have any visfloors yet, and I don't have also no error after executing this command but it not works.

Code:
res = db:execute([[
INSERT INTO visfloors (`id`, `building`, `layout`, `type`, `sortorder`, `name`, `background`, `background_add`, `bgcolor`, `touch_bgcolor`, `bgrepeat`, `bgfixed`, `usermode_param`, `touch_param`, `width`, `height`, `locx`, `locy`, `pincode`) VALUES
(`1`, `1`, `8`, ``, `1`, `0.00_Witaj`, ``, `0_00_Witaj.svg`, ``, ``, `0`, `0`, ``, ``, `1024`, `748`, ``, ``, ``),
(`2`, `1`, `424`, ``, `56`, `1.01_Klatka schodowa`, ``, `1_01_Klatkaschodowa.svg`, ``, ``, `1`, `0`, ``, ``, `1024`, `748`, ``, ``, ``)
]])

-- res: nil

I know that probably I can use db:insert() but as I checked yesterday it only works for one row not many.

SOLVED: I've changed `` with "" and used integers where it is possible
Done is better than perfect
Reply
#2
But now I have such situation:

I've imported visfloors and then visobjects (all by insert sql).

I have these floors and objects in db but only Layouts and Widgets are visible in UI. I've tried to refresh web browser and reboot LM but without any progress.

What is necessary to create in script new plan and objects?
Done is better than perfect
Reply
#3
You plan must reference an existing level (building field in visfloors table -> id field in visbuildings table).
Reply
#4
(20.07.2020, 06:16)admin Wrote: You plan must reference an existing level (building field in visfloors table -> id field in visbuildings table).

In visbuildings I have 2 buildings:
id: 1, name: "Main",
id: 2, name: "Floors"

In visfloors I have first plan:
id: 1, building: 1, layout: 8, type: "", name: "0.00_Witaj" ...

And this plan has at least one below object:
id: 6301, floor: 1, type: 0, object: 3174, statusobject: 3174

So it should be visible in plans but I don't have it, I have only Layouts and Widgets.

And when I click on Main->Export then I have big backup including above plan with id 1.

Attached Files Thumbnail(s)
   
Done is better than perfect
Reply
#5
type must be NULL not an empty string
Reply
#6
ExactlyWink

Thank you very muchWink
Done is better than perfect
Reply


Forum Jump: