Strange Data Issues

I am having a hard time with data issues. My initial imports went well but then I hit my stock table which has a relation to warehouse and to product.

I tried to import data and it failed giving me a quite cryptic failure file:

  • I dropped the relations and imported the data with the relation fields as string.
  • I was then able to see the data in the data explorer.
  • I then re-instated the relations and data explorer then shoed no data.
  • So I dropped the relations again and then deleted the table.
  • After stopping and starting the system data explorer showed that the table no longer existed
  • I then recreated the table with relations
  • Data explorer showed the table with no records as expected
    But what I do not understand is that when I preview my app I can see the stock records keyed against the products:

    And when I create a whole new stock page with listing bound to new stockListing namespace I can see the stock records:


    Data explorer shows no records and seems to freeze up when you ask it to display records from any table that has not data in it?

Hello Douglas,

Does the issue persist even after clearing the browser’s cache of the tab where the Data Explorer is open?

Yes used Empty cache and hard reload. Clicking on the Stock table in the data explorer generates this error in console:

Are you using any computed attributes or fields that might contain an error? It’s possible that there’s a syntax issue in one of the computed attributes, or a value is being assigned to a field with an incompatible type.
Could you please double-check the data types of your Stock’s table attributes and ensure the values assigned to them are correct?

Pretty simple data. Sample below:

id,fk_warehouse,fk_product,locationCode,inStock,demand,supply
BF4E2E58315FFA48BB56F8D53D07EF56,5ADD1C97A3423846A13564B823154DF1,14E8DB34EE13574BA2117F934EACF5BF,,6,2,3
D9C3A274D6387049A310F54FC1E86B9B,5ADD1C97A3423846A13564B823154DF1,21A69ACEFEBE9C419969CFE91ED2562F,,13,2,18

of the imported csv
Also model not that complex:


There are no computed values…

Definitely a data/model issue but I have no clue how to resolve?

As soo as I try and include the fk_warehouse property on the stock listing in the productDetail Qodly just crashes out. I removed both relations:


and the data will now show in the data explorer albeit I do not understand the expand boxes on the fk_warehouse and fk_product properties:

Hello,

As I understand, when designing Qodly data model you have to think relation as link between entitySelection and entity (and not between PK and FK as in 4D data model)

So, in your table ‘Stock’ you should replace the ‘fk_wharehouse’ and ‘fk_product’ UUID fields
by ‘wharehouse’ and ‘product’ entity fields.

ie :

But maybe, there is other way to manage relation with Qodly

Like this:


The name of the property was confusing you maybe?

The picture that showed them as UUID fields was me removing the links so the data explorer would render the data.

You can rename them as ‘wharehouse’ and ‘product’. Then you can write code like :

stock.wharehouse.name

Do you think renaming the property would solve my data issues?

To import a related entity to a table, you can follow these steps:

Example:

Let’s say, in your structure case, you already have data in warehouse and product and you want to import stock data now:

The Stock table contains two entity-type attributes: fk_warehouse and fk_product, which reference the Warehouse and Product tables respectively.

Mapping the Data:

During the import process, once you map the columns of your data file to the corresponding attributes in your table, you’ll get a preview of how the data will appear:

importProcess

If the import goes through without generating any error files, and the related entities (e.g., the fk_warehouse) is correctly referenced (usually by its UUID), you’ll be able to see the imported records in the Data Explorer:

Also, ensure the UUIDs assigned to entity-type fields (like fk_warehouse and fk_product) actually exist in their respective referenced tables. If they don’t, the related data won’t link properly, and the records may not show as expected in the Data Explorer.

Fadwa,

Firtsly thank you for taking the time to do that video. I can confirm that everything you have shown is exactly what I have done, multiple times. The only step that never works is showing the data in the data explorer which just bugs out and displays no stock records.
When I delete the relations the data shows. In the app though the data displays and relates fine.

The one thing I did take from your last screenshot and another comment was that I was thinking of the relation as a storage property and trying to access fk_warehouse in my stock listing which simply crashes the data list it is put on with an oops message:


I realised I have to think about this differently and that if I want to access that value I have to use fk_warehouse.id (where id is the warehouse id property. Here is the result in product showing the stock from two warehouses where I am referencing fk_warehouse.name:

I am thinking that I may have to start the project from scratch???
In the process of trying to fix things I now see there are remnants of things that simply should not be there that the database engin is holding on to.


In the image you can see un-related relations that cannot be removed. I tried deleting bot the warehouse and product tables but when I added them back as new tables they cam back in before.

Even with no relation I cannon now change the data type of the warehouse relation. It has all just gone pair shaped and I am not sure f it is really worth pursuing. Maybe I will try again in 6 months…

We’ve already experienced this strange behavior…

To resolve that situation you can open the model in text editor :

and then remove unwanted related attributes :

1 Like

Thank you for this tip. I had already deleted and recreated the tables and re-imported the data. I still have issues.

Edited as I have moved on to other issues…

that’s a cool tip, right there

Yes it was very useful for re-ordering my fields. Just be very careful :slight_smile:

HEK NO. listen, the moment project mode came out, i started hacking the 4d.catalog file. this is right in my wheelhouse/zone of temptation. i will break because i care.

1 Like

This data explorer issue was identified during our discussion and has now been resolved.
It turned out to be a cache-related problem, which was fixed by clearing the local storage cache from the Application tab in the Data Explorer browser’s developer tools (Inspect).

Just sharing here in case it helps someone else facing the same issue. :slight_smile: .

2 Likes