• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LiveCloud arrays and Datagrid
#11
Thanks Efrain

Ok, this is all coming together and making sense

Appreciate the assist
  Reply
#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


Forum Jump:


Users browsing this thread: 2 Guest(s)