Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 349
» Latest member: customrubber
» Forum threads: 240
» Forum posts: 1,069

Full Statistics

Online Users
There are currently 39 online users.
» 0 Member(s) | 37 Guest(s)
Bing, Google

Latest Threads
using cdb_auth with Live...
Forum: General
Last Post: JereMiami
12-19-2024, 01:58 AM
» Replies: 0
» Views: 27
BLOBs - not possible to a...
Forum: General
Last Post: stamatis
10-06-2024, 06:28 PM
» Replies: 0
» Views: 261
Allow users to change the...
Forum: General
Last Post: mark_talluto
01-18-2024, 01:09 AM
» Replies: 8
» Views: 11,441
cdb_sendEmail
Forum: General
Last Post: mark_talluto
11-07-2023, 09:57 PM
» Replies: 0
» Views: 688
cdb_sync & cdb_lookupvalu...
Forum: General
Last Post: mark_talluto
11-07-2023, 09:45 PM
» Replies: 1
» Views: 1,241
cdb cdb_sendEmail
Forum: Bug Reports
Last Post: JereMiami
10-05-2023, 01:57 PM
» Replies: 0
» Views: 1,770
LCM: "Please inform Canel...
Forum: General
Last Post: mark_talluto
07-12-2023, 07:58 PM
» Replies: 24
» Views: 23,250
San Franciso Region Outag...
Forum: Announcements
Last Post: mark_talluto
05-09-2023, 03:31 AM
» Replies: 1
» Views: 2,880
Error, CDB_Header checksu...
Forum: General
Last Post: cpuandnet
02-01-2023, 05:00 AM
» Replies: 4
» Views: 3,934
CDBCache sync from local ...
Forum: General
Last Post: Hendricus
01-29-2023, 09:39 PM
» Replies: 2
» Views: 2,779

 
  code to unpack query array to tab-delimited data?
Posted by: sltfn - 08-19-2019, 07:26 PM - Forum: Code Samples - Replies (4)

Hello. I am very new to and still much in the dark about arrays. I am looking for efficient code to unpack the output from a query to lines of tab-delimited data (one record per line). Here is the code I've come up with so far. I'd guess there MUST be a more efficient approach.

on mouseup
## query constructed above
 put cdb_batchQuery(tInputA,"cloud","logicalAND","recordData") into tOutputA
 put flattenArray( tOutputA) into flattened -- see flattenArray function below
end mouseup

function flattenArray A , d1, d2, T,  X
   if T is empty then
      if d1 is empty then put cr into d1
      if d2 is empty then put tab into d2
   end if
   if A is not an array then return T  & X & A & d1
   repeat for each key K in A
      put flattenArray( A[K],  d1, d2, T,  X & K & d2 )  into T
   end repeat
end flattenArray

This yields the queried records in this format (just one record of many shown here).

[CDB Table ID]    1    [CDB Record ID]    ATTRIBUTES    fopn
[CDB Table ID]    1    [CDB Record ID]    LAST_NAME    Jordan
[CDB Table ID]    1    [CDB Record ID]    STATUS    linnm
[CDB Table ID]    1    [CDB Record ID]    RANK    2
[CDB Table ID]    1    [CDB Record ID]    CITY    San Francisco
[CDB Table ID]    1    [CDB Record ID]    YEAR    2019
[CDB Table ID]    1    [CDB Record ID]    ROLE    5
[CDB Table ID]    1    [CDB Record ID]    NAME    Sam Jordan
[CDB Table ID]    1    [CDB Record ID]    DATE    2019-02-17
[CDB Table ID]    1    [CDB Record ID]    cdb    cdbDateModified    1562677087
[CDB Table ID]    1    [CDB Record ID]    cdb    cdbDateCreated    1562677087
[CDB Table ID]    1    [CDB Record ID]    cdb    cdbRecordID    [CDB Record ID]
[CDB Table ID]    1    [CDB Record ID]    cdb    cdbTableID    [CDB Table ID]
[CDB Table ID]    1    [CDB Record ID]    cdb    cdbRecordVersion    1
[CDB Table ID]    1    [CDB Record ID]    cdb    cdbTableName    stats
[CDB Table ID]    1    [CDB Record ID]    cdb    cdbCloudSyncVersion    1

I then loop through the lines and remove the first two columns, then I filter out the lines with "cdb" keys not needed in my app as long as I preserve the record ID, and get a list of records like this…

[CDB Record ID]    ATTRIBUTES    fopn
[CDB Record ID]    LAST_NAME    Jordan
[CDB Record ID]    STATUS    linnm
[CDB Record ID]    RANK    2
[CDB Record ID]    CITY    San Francisco
[CDB Record ID]    YEAR    2019
[CDB Record ID]    ROLE    5
[CDB Record ID]    NAME    Sam Jordan
[CDB Record ID]    DATE    2019-02-17

Finally, I loop through the lines again and put the data for each record into the tab-delimited format I need, which is something roughly like this…

fopn    Jordan    linnm    2    San Francisco    2019    Sam Jordan    2019-02-17    [CDB Record ID]
ucpn    Smith    linnm    1    Los Angeles    2019    Susan Smith    2019-06-23    [CDB Record ID]

efrain.c and mark_talluto's suggestions for batch record creation and updates were VERY helpful. Thank you.

Does anybody have a simpler solution for this problem? Pretty sure there must be one (many). Thanks in advance.


  Floating windows Code snipet cannot close
Posted by: jsubiros - 08-19-2019, 11:31 AM - Forum: Bug Reports - Replies (1)

Hello,

I have LiveCloud Manager with Windows 10.
When I press code snipet button, cannot close the window and come back to data.



Attached Files Thumbnail(s)
   

  Any way to change location once its set up?
Posted by: sid - 08-18-2019, 02:02 PM - Forum: Getting Started - Replies (2)

Hi Everyone,

 I'm new to all this and based in South Africa. 

Unfortunately I picked San Francisco as the location when I set up the livecloud account. Its really really slow and frustrating so I would like to change the location to LON1 (London UK) If there any way to do this without creating a totally new account? I just need a feature to transfer my account to the closer location...

According to most people in the DigitalOcean LON1 is the best option for us here in SA.

I wonder what the lag times would be for fellas in Austrailia?

Sid


  Minor Error on AdvancedQuery Documentation
Posted by: simon.schvartzman - 08-12-2019, 04:41 PM - Forum: General - Replies (2)

Hi LiveCloud team, I'm afraid there is a LiveCode error on the Example 1 (see picture) as the "into" part of the following statement is missing

put cdb_advancedQuery(tDataA,tAdvancedMap,tTable,tTarget,tResultFormat)


   

Best.


  About CDBCache behaviour
Posted by: simon.schvartzman - 08-09-2019, 11:45 AM - Forum: General - Replies (2)

Hi, I have the following doubt for which I would appreciate a clarification.

According to the documentation:

"...any time your users lose their internet connection, CanelaDB will cache this transaction. The transactions are saved even if the application shuts down, so you never have to worry about missing your cloud calls."

I don't get when the cached transactions will be written to the cloud. In other words will this happen the next time the user launches the application or...?

Many thanks in advance


  Mist Plan
Posted by: mark_talluto - 07-27-2019, 12:18 AM - Forum: Announcements - No Replies

We just did a quick update to the site to reveal the 'Mist Plan'. It has been available in LiveCloud Manager for some time now but wanted people to know it exists when they visit the site. This plan is designed to be useful for testing the service. Learn how the APIs work and get comfortable with LiveCloud Manager. Enjoy!

-Mark


  The Code Sample Thread
Posted by: clarencemartin - 07-26-2019, 03:35 AM - Forum: Code Samples - Replies (1)

Thanks, Canela Software for this Thread. I hope that the users of LCM and the forum will find this a useful thread.
I will be posting things that I find and hope to get clarification of the LCM API's.


  Creating unique number for a Invoicing
Posted by: Peter - 07-24-2019, 08:19 AM - Forum: General - Replies (1)

Is it possible to create a Unique number for ie: for invoicing:


  speed & reliability
Posted by: sltfn - 07-23-2019, 08:23 PM - Forum: General - Replies (12)

Hello,

I have a question similar to simon.schvartzmann's in the thread "Livecloud x Dropbox performance."

The app I hope to get working with acceptable performance & reliability will replace an app that reads from and writes to a server-based MySQL database. I've not generated comparative numbers but am finding queries and updates to my LiveCloud table to be significantly slower than with MySQL. I'm trying to decide if the slower performance will be within the range of acceptability or not.

In addition to the speed issue, I'm finding that updates to records sometimes fail. In my most recent test, updating c730 records in rapid succession, looping through a tab-delimited list in LiveCode, updates for 5 of the records failed, so a failure rate of about 0.7%.

Of course, the only acceptable failure rate overall is 0%. I've built in an extra loop to take the list of failed updates and try updating again. In this test the 5 updates that failed initially all went through on second try but I'll need to incorporate a system that repeats until there are no failures and all records get updated.

Back to the speed issue. The pattern seems to be that the update process will run relatively quickly for some number of records and then there is a "hang," in which I'll receive messages for several seconds to the effect the server response cannot be downloaded at this time.

Is there anything I can do in my LiveCode scripts—perhaps wait for a fraction of a second between updates?—that might improve reliability? Is LiveCloud being overwhelmed by updates in rapid succession? If a wait command might help, what length of time? Each fraction of a second is, after all, a fraction of a second one would rather not add to processing time.

For my app to work acceptably well, I'll need to be able to update as many as 3000–4000 records in sequence without having to hold things up until the whole batch, including retries on failures, is complete.

What should I try? Thanks in advance.


  Livecloud x Dropbox performance
Posted by: simon.schvartzman - 07-22-2019, 01:54 PM - Forum: General - Replies (3)

Hi, I have this APP where I use Dropbox to upload pictures to the cloud and I'm considering to replace DB by Livecloud.

Before releasing the Livecloud based APP into production I decided to put together a simple test (stack attached that basically uploads a 200K picture)  in order to compare the performance of both options and  the results show that Livecloud is outperformed by Dropbox in 5 out of 6 samples (see attached table). 

In average an upload to Livecloud is 36% slower than to Dropbox.

I wonder if there is something I didn't consider in order to get better results from Livecloud (force sync?).

Many thanks in advance.



Attached Files Thumbnail(s)
           

.zip   LCM Test.livecode.zip (Size: 557.48 KB / Downloads: 4)