Putting specific keys into the text of a option menu - Printable Version +- LiveCloud Forums (https://forums.livecloud.io) +-- Forum: General (https://forums.livecloud.io/forumdisplay.php?fid=1) +--- Forum: General (https://forums.livecloud.io/forumdisplay.php?fid=3) +--- Thread: Putting specific keys into the text of a option menu (/showthread.php?tid=317) Pages:
1
2
|
Putting specific keys into the text of a option menu - sid - 02-08-2020 Hi Guys I'm stuck on something. I want to store a list of options in the livecloud database that i will insert into the text of an option menu , or combo Box Menu control (Basically a dynamic drop down list) It works fine if there id only one record in the table, for example: Code: put cdb_read("companySetup","*","local") into tBranchData RE: Putting specific keys into the text of a option menu - efrain.c - 02-10-2020 Hi sid, The keys of the output array are recordIDs of the records. When you say "the keys of tBranchData", there is only one record in the table so there is only one recordID in the keys of tBranchData. Because of this, tBranchData[the keys of tBranchData] evaluates correctly. However, when you say "the keys of tTaxTypes", there are multiple records in the table so there will be multiple keys in tTaxTypes. Because of this, tTaxTypes[the keys of tTaxTypes] will not evaluate correctly. The following is one way of creating the list you want: Code: repeat for each key xRecordID in tTaxTypes RE: Putting specific keys into the text of a option menu - sid - 02-11-2020 Thanks Efrain This worked like a bomb. I have a feature request . why don't you add a ,format parameter to the query command. This way us newbies will find it easy to code. so, : put cdb_read("taxTypes","*","local") can be: put cdb_read("taxTypes","*","local","tablist") you can add 'datagrid list" etc I must say, having no previous programming experience , I am 20 percent done writing an ERP product using livecloud and livecode. Im a big fan. Thanks for the awesome response times and great customer service Sid RE: Putting specific keys into the text of a option menu - mark_talluto - 02-12-2020 function cdb_Query(pKey, pOperator, pValue, pTable, pTarget, pResultFormat) We could add "datagrid" to pResultFormat. Other format options could be added. - JSON - List from a single key RE: Putting specific keys into the text of a option menu - mark_talluto - 02-12-2020 I just realized that you are not using a query to get your data in this example. I read it too fast. Sorry about that. You can use function cdb_list(pTable, pTarget, pKeys) https://docs.livecloud.io/List/ RE: Putting specific keys into the text of a option menu - mark_talluto - 02-13-2020 You may wonder what the difference is between cdb_list() and cdb_readKeys() cdb_list() returns a line delimited string. If there are more than one key, the data is comma delimited by keys and line delimited by records returned. Choose this API if you do not need to the the recordIDs of the returned data. This API is perfect for Sid's needs above. cdb_readKeys() returns a structured array with a primary key of recordID/keys/values. Choose this API if you need to know how to identify the results with recordIDs. This would not be a good fit for Sid's example as he would have to parse the data himself as in Efrain's sample code. RE: Putting specific keys into the text of a option menu - sid - 02-14-2020 Thanks Mark and Efrain This clarifies a lot Sid RE: Putting specific keys into the text of a option menu - sid - 04-26-2020 (02-12-2020, 06:53 PM)mark_talluto Wrote: function cdb_Query(pKey, pOperator, pValue, pTable, pTarget, pResultFormat) Hi Mark is the pResultFormat parameter operational? I can't seem to get it to work and still have to use the repeat code Sid RE: Putting specific keys into the text of a option menu - mark_talluto - 04-27-2020 Hi Sid. I will have a look tomorrow morning. I'll let you know what I find out. If there is a bug, we can get that fixed quickly. RE: Putting specific keys into the text of a option menu - Jason Lam - 04-28-2020 Hi Sid, The current supported pResultFormat from cdb_query is "recordList" and "recordData". "recordList" might not be useful for your use case since it just returns a list of cdbRecordIDs. If you choose "recordData", you will still have to use the repeat code that Efrain provided from previous post. Alternatively, you could use cdb_list suggested by Mark to avoid using the repeat code. |