Towards the end of Marks tutorial…
he creates a nested list of data items, a list of cities within a list of countries.
When creating the ‘Dynamic Items Logic’ for Cities, Mark gets…
whereas I get…
I have tried putting ‘blkCountries Item Data’ into that spot but it did not display the list of cities in the preview.
I also tried…
I also changed all objectid to objectId, still no work.
And I do have the correct binding on the text field…
What can I put into the empty jigsaw spot?
It should be
blkCountries Item Data. That’s the object that has the country object. There were some changes in the design after I recorded the video. The
blkCountries in your case would be the entire collection, while
blkCountries Item Data would be a single object (which is what you want).
Yes I did try that, remembering a similar answer you gave me on a prior exercise.
So where could the problem be?
The text box, txtCityName, in the middle of the blkCity is…
You can see that it has the ‘Content Logic’ set to Name (which is the name of the column in table City).
fyi, the result I am getting so far is…
It was a while ago when I recorded the video, so I apologize, I do not quite remember what I did there. What is the actual problem with the app?
It was a very good tutorial, covering a really valuable topic.
Basically you created a dynamic block linked to Country with the Country name flowing down the page (as per my prior screen shot.
Inside the Country block you created a left-right block to contain all the Cities in a Country.
From your tutorial the final result is…
So I am not getting the City Names between the Country Names. I have everything in place as far as I can tell.
My design screen looks like…
and the text box in the middle is bound to Name from the City table.
I remember that one. What is your app ID, I’d like to take a look at what you have. Also, please let me know the name of the page.
AppID = 65C3C696-81FC-DB1A-FF40-2B2B4CEF7000
Here’s how you can debug issues like this.
- Run the page in the Preview mode
- Open the browser’s Devtools panel (Chrome does it best). Switch to the
- Reload the page.
- For your page you will see the following:
- Select one of the errors and switch to the
Response tab as shown below:
Here you will see the error the backend returns. By looking at the schema, the error makes perfect sense, there is indeed no
Country column. The relation column connecting
Country tables is called
So to fix this problem, all you need to do is to change
CountryCode in here:
I haven’t tried it, but I am pretty sure that it will do it.
Yep, sure did do it.
I would never have guessed that CountryCode = objectID, but now I see it I can see why.
This is different from the tutorial, but an answer that works is a good answer.
No, it should be
CountryCode.objectId = '
I am surprised it works with just
CountryCode = '
Yep, that works too.
In your tutorial you put Country.objectID. I took that to be Tablename.ColName.
But it seems I have ended up with Colname.Colname.
I am guessing that CountryCode worked by itself because its value is actually objectID to satisfy the relationship, would I be right?
Anyway, thanks Mark, I have moved onto the next tutorial now, Adding Data into the database, and the relationship is not working there either. I will use your debugging technique before I ask for help.
When you retrieve data from a table and use a where clause, the where clause references are always column names. In my video I must have renamed CountryCode column to Country. When it is a relation column, then it must followed by a column from the related table. Hence we get CountryCode.objectId.
Hope this helps.
This is just a suggestion rather than a problem. I did strike a problem with the Add Data to Database tutorial, but it was me, not the tutorial or backendless.
To get to my bug, I sprinkled Try Catches and Show Alerts around the main code blocks.
This worked well, just one thing,
I love backendless and UI builder, but can the ShowAlert be made to look better. I realise that making text boxes visible and invisible can do the same job, but ShowAlert is better.
I would like at least, to replace the default title that you see here, with a title of my choice.
As I said, just a suggestion.
Thanks for the offer!
I created an internal ticket (BKNDLSS-24339) to discuss the possibility of adding this feature.
Brilliant, thank you, I hope it gets approval. Please keep me in touch with developments.
My understanding is the alert window we use is not stylable. See the discussion on SO here.
Rather than using the “Show Alert” block, I recommend using the “print” block. The block will output your logging messages to the browser’s developer console window. Here’s a great overview of DevTools console:
The difference between the approaches is huge - alert blocks the execution of your app and cannot be styled. Console does not block and you can see the log messages as the app runs.
The popup ShowAlert would mainly be useful for displaying information to the user rather than debugging. Your technique in your tutorials is to create a text box in a coloured block, and which you control the visibility of. Without a ShowAlert, in which I can set my own title, I will continue this way.
Thanks for the advice.