+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

Questions on JsonDataProvider

Hello Jochen,
I followed your advice and actually I got the possibility to mirror all single elements in variables, so thanks for your advice to use events :wink:

In a previous post, you indicate that it is possible to move instead of to mirror: indeed, I found duplicated info between variables and fields, please could you indicate me how to move?

I am sorry, but I would like to ask you two more things :slight_smile:
I debugged this code:

void LL_AutoDefineField(object sender, AutoDefineElementEventArgs e)
{
_LL.Variables.Add(e.Name, e.Value);
}

I realized that e assumed effectively the values of individual fields (e.g. active-table or active-table-name, according to next snapshot), except in one case, when to e the values in the yellow box have been passed (three times, each of them as an individual):

immagine
It did not make sense to me, did it?

Finally, the last thing. We would like to organize the folders respecting the structure of the json file, indeed, at present, all elements are on the root of Fields.
Besides, some of them are renamed: for instance, in our json, there are two groups of machinings, one inside groups and another inside parts, but they both have been reported on the root with two different names (machinings and machinings1).
Is it possible to nest folders? In the documentation, I found something that describes this possibility but just using API (if I have understood correctly).

I still want to thank you in advance.
Nicola

Hi Nicola, I’ve split this to a new topic in order to keep the discussion in Idea Place on topic :slight_smile:.

This can be done by setting e.Suppress to true. In that case, List & Label will not add the data as fields.

As “machinigs” is an array with three (I assume) different objects in it each instance is passed separately. For “machinings”, it would probably be better to leave the data as fields and place a table in the designer. That way, you can print all three instances.

If you pass the variables with the required hierarchy this will be reflected in the Designer then. However, this would have to be done by your code then. Simply use the “.” as hierarchy separator, i.e. something like

_LL.Variables.Add("Folder.SubFolder.AnotherSubFolder."+e.Name, e.Value);

would do the trick.

I hope this helps.

1 Like

Hi Jochen,
after some tests, I am going to answer to your indications.

I’m making some mistake since elements added by Variables.Add are both in variables and fields:

immagine

Here the code I am using:

        private ListLabel _LL = new ListLabel();
        Stream fileStream = File.OpenRead(jsonpath);

        using ( StreamReader reader = new StreamReader(fileStream))
        {
            _LL.DataSource = new JsonDataProvider(reader.ReadToEnd());
            _LL.AutoDefineField += new AutoDefineElementHandler(LL_AutoDefineField);
        }

        void LL_AutoDefineField(object sender, AutoDefineElementEventArgs e)
        {
            e.Suppress = true;
            _LL.Variables.Add(e.Name, e.Value);
           // I tried also inverting these last two rows
        }

Do you see something wrong?

I agree, Jochen,
machinings should be only part of fields, to place them in a table.

According to me, it should not be intercepted by LL_AutoDefineField function, should it?
If it is intercepted, another similar case should as well, but it is not (I am referring to the next snapshot as an example):


Have you some suggestion?

Yep, but I was talking about fields, they are imported automatically:

immagine

Is there a way to take action on fields import?

Unfortunately - no. The structure of the JSON is mimicked by the treeview when adding a new report container. The fields view is flat and shows the different tables that have been parsed from the model. As table names need to be unique, a number is appended to them if an existing table with the same name is encountered.

1 Like

Would it be possible to add your JSON here for an analysis? We’d be happy to take a closer look then.

Yes, it would, but I get this error:
immagine

Unfortunately, it is not even allowed to share a link.

Here is the file Jochen:
EwdGetInfo_2pieces.xml (109.5 KB)
I had to change the extension (I used xml) since json is not an allowed extension.

Regards.

1 Like

Hi Jochen,
I’m sorry to bother you, unfortunately we’re stuck with our project.
If you don’t succeed in checking our issues, could we get the JsonDataProvider.cs to debug it?
I understand if you might have some concerns about it, I am taking the liberty of asking it to simplify your job.

Regards.

Hi Nicola,

No problem, asking is fine anytime. Also, if you find issues we all profit from this. According to our records, you should have access to the full .NET source code in the service pack download area. I’m also attaching the sources for the provider itself here. If you’d like to debug into different classes, just download the full sources, they are uploaded daily.
lljsondataprovider.cs (33.7 KB)

1 Like

Jochen,
I don’t understand, I did not succeed in login with our credentials any longer.
When we bought the license, our secretary’s credentials (alessandra.rota@ddxgroup.it) have been used and I successfully used them last week to access, but now they don’t work any longer :confused:
I tried to use the “forgotten password” utility, but the result was: Benutzer unbekannt.

Please could you help me?

I’ll ask Sonja from the sales dept to follow-up.

1 Like

Please try to set the following property for the List&Label instance.
->_LL.DataBindingMode = DataBindingMode.Preload;

This will preload/define the fields and the event will be called for each field.

The result of your code would then be that all fields are suppressed and registered as variables.
Your code:

   private void _LL_AutoDefineField(object sender, AutoDefineElementEventArgs e)
    {
        e.Suppress = true;
        _LL.Variables.Add(e.Name, e.Value);
        // I tried also inverting these last two rows
    }

If there are any discrepancies in the DataBindingMode.Delay mode we will look into it, we will notify you if there is something new, but the recommended way is from us->DataBindingMode.Preload;.

1 Like

© combit GmbH