• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LiveCloud arrays and Datagrid
#12
(11-21-2019, 07:03 PM)efrain.c Wrote: Hi Bizbuzz,

I haven't used the datagrid much, this might've been my first time using it, but after tinkering for a bit I have the following script to populate a datagrid from a Livecloud array:

Hello will this code populate the datagrid with the data from livecloud?

I have an expense table with expenseName, expenseAmount
when the card is opened I want all the expenseNames and amounts to be loaded in the datagrid.


Code:
on mouseUp
    local tKeys, tOutputA, tCount, tDataA
   
    set the dgData of group "datagrid" to empty
   
    put cdb_tableKeys("testTable") into tKeys
    put cdb_read("testTable", "*", "cloud") into tOutputA
   
    put 0 into tCount
    repeat for each key xRecordID in tOutputA
         add 1 to tCount
         
         put tOutputA[xRecordID]["cdb"]["cdbRecordID"] into tDataA[tCount]["recordID"]
         repeat for each item xKeyName in tKeys
              put tOutputA[xRecordID][xKeyName] into tDataA[tCount][xKeyName]
         end repeat
    end repeat
   
    set the dgData of group "datagrid" to tDataA
end mouseUp


I set the row height to 70 and the column names to the table keys through the property inspector before running the code above. The row height stayed the same after running the code. I might be missing something. If you have a sample stack, I can take a look at it.

The code has not been commented making it very hard to understand.

Efrain cann you please comment the code?


Code:
on mouseUp
    local tKeys, tOutputA, tCount, tDataA
   
    set the dgData of group "datagrid" to empty
   
    put cdb_tableKeys("testTable") into tKeys
    put cdb_read("testTable", "*", "cloud") into tOutputA
   
    put 0 into tCount
    repeat for each key xRecordID in tOutputA
         add 1 to tCount
         
         put tOutputA[xRecordID]["cdb"]["cdbRecordID"] into tDataA[tCount]["recordID"]
         repeat for each item xKeyName in tKeys
              put tOutputA[xRecordID][xKeyName] into tDataA[tCount][xKeyName]
         end repeat
    end repeat
   
    set the dgData of group "datagrid" to tDataA
end mouseUp


I set the row height to 70 and the column names to the table keys through the property inspector before running the code above. The row height stayed the same after running the code. I might be missing something. If you have a sample stack, I can take a look at it.
  Reply


Messages In This Thread
LiveCloud arrays and Datagrid - by Bizbuzz - 11-21-2019, 11:01 AM
RE: LiveCloud arrays and Datagrid - by efrain.c - 11-21-2019, 07:03 PM
RE: LiveCloud arrays and Datagrid - by Papa Cann - 02-23-2020, 03:47 PM
RE: LiveCloud arrays and Datagrid - by efrain.c - 02-24-2020, 06:26 PM
RE: LiveCloud arrays and Datagrid - by sid - 12-14-2019, 11:27 PM
RE: LiveCloud arrays and Datagrid - by sid - 12-16-2019, 09:31 PM
RE: LiveCloud arrays and Datagrid - by efrain.c - 12-17-2019, 02:14 AM
RE: LiveCloud arrays and Datagrid - by sid - 12-17-2019, 09:54 PM
RE: LiveCloud arrays and Datagrid - by sid - 12-18-2019, 10:20 PM
RE: LiveCloud arrays and Datagrid - by sid - 12-19-2019, 10:12 PM
RE: LiveCloud arrays and Datagrid - by sid - 02-14-2020, 02:56 PM
RE: LiveCloud arrays and Datagrid - by efrain.c - 02-14-2020, 08:47 PM
RE: LiveCloud arrays and Datagrid - by sid - 02-15-2020, 07:52 PM
RE: LiveCloud arrays and Datagrid - by sid - 02-24-2020, 07:52 PM
RE: LiveCloud arrays and Datagrid - by efrain.c - 02-24-2020, 09:17 PM
RE: LiveCloud arrays and Datagrid - by sid - 02-24-2020, 09:39 PM
RE: LiveCloud arrays and Datagrid - by sid - 06-26-2020, 11:34 PM

Forum Jump:


Users browsing this thread: 6 Guest(s)