Searching for User Parameters - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Searching for User Parameters (/showthread.php?tid=2469) |
Searching for User Parameters - pspeirs - 12.02.2020 Hi All, I'm trying to find a user parameter via a keywork (tag) search rather than the parameter name much like I can do it with other types. I've looked at running a sql query in a function to do it however I can't seem to associate a keyword with the parameter name. I can use: SetUserParam('Local Network', 'w_obs_wind_dirtext', value) however I want to set the value based on the keywork like SetCBusByKW({'irrigation_current_runtype'}, 'or', {target = 1, ramprate = 0}) I have some db helper functions like the below, so not opposed to doing something in a query. function db_GetObjectByTag(tag) -- Return a table of object parameters based on the id local query = string.format('SELECT * FROM objecttags WHERE tag = "%s"', tag) liste = db:getall(query) if (table.maxn(liste) ~= 0) then return liste else return false end end Cheers, Paul RE: Searching for User Parameters - Daniel - 12.02.2020 Why don't you use build in function? myobjects = grp.tag('tag') RE: Searching for User Parameters - pspeirs - 12.02.2020 (12.02.2020, 13:20)Daniel. Wrote: Why don't you use build in function? I don't have that function on the SCAC available for user parameters. The logic machine is very similar, but with some mods. A lot of the info on this forum is applicable, particularly around the lua scripting options. RE: Searching for User Parameters - admin - 13.02.2020 User parameter is standard LM object so grp.tag should work. Have you actually tried it? RE: Searching for User Parameters - Daniel - 13.02.2020 I tried it on NAC and it works RE: Searching for User Parameters - pspeirs - 13.02.2020 Yep. tried it and it works for a read, is it possible to write using a similar methos via tag? Paul RE: Searching for User Parameters - Daniel - 13.02.2020 It depend what you want to write. RE: Searching for User Parameters - pspeirs - 13.02.2020 Pretty much anything that can be written to a user param, string, integer, float. RE: Searching for User Parameters - admin - 14.02.2020 Writing is done like this: Code: value = 123 RE: Searching for User Parameters - pspeirs - 15.02.2020 Awesome, thats what I need, thanks. Is there documentation available on this type of thing, the CBus documentation is pretty basic. Cheers, Paul RE: Searching for User Parameters - Erwin van der Zwart - 15.02.2020 Hi, See: https://openrb.com/docs/lua.htm BR, Erwin |