Load Table Objects Block codeless

In the spirit of scalability webinar. Please modify LoadTableObjects block or creat another one that return only 1 object not a list.

I use affiliate ID as a way to find the user rather than expose their object id on the UI from shared link URL parameters. Problem is to get different properties out of the returned result which is an array list I have to use array blocks such as (getfirst) which uses loops. As you know loops slow down API performance.

I know I can use getfirst object out of the result to convert it to an object directly but why add an extra step in between a loop step non the less.

I suggest that LoadTableObjects block have an option to return a single object or another block but to get a single object.

my API call takes 4 seconds or 3900-6000 ms range. I tried to minimize loops as much as I can in that logic.
latest log result
23:58:7.808 | SERVER_CODE | INFO | [27564] Processing finished in 3918.954ms

if you have suggestion to speed up the API that would be great, anything under 1000ms is better than 4000-6000 ms

The simplest workaround for this is to create a custom function. Here’s how you can do it (see the screenshot below). Once defined, the function is available in all pages (or in Cloud Code if you define it there). The elegance of this approach is you can declare as many arguments in your function as needed and then simply pass them through into the underlying call.

I figured that out. But that don’t solve the underlying issue that the speed of execution will be slowed down due to the list loop anyway. Do you have any suggestions for speeding up the code?

The logic I shared retrieves only 1 record (see the page size argument). Therefore there is absolutely no impact on the speed of execution since there is no loop anywhere whatsoever - the returned data structure is an array of 1 record.

I can see that. But how come my API code takes 4000-6000ms to run everytime what do you think is the culprit in the code? and what can I do about it

I suspect the culprit is in the logic. I suggest adding logging to time individual steps of your logic - the print block will output the messages that you can check in the Real-Time Logging window - there is a button to open it in the Cloud Code section of the Backendless console.


How to add timer in blocks the timers blocks available don’t allow this

Could you clarify your question? I’m not sure if I understand it correctly.

What do you want to do directly?

Regards, Dima.

I want to print timer in log to check how fast each part of the code run in codeless

For this purpose you could use logic below:

Regards, Dima

thank you