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

Labels: how to set DataMemeber programmatically

Hello,
I would like to print labels from a json, where data source contains multiple tables. According to programmer’s manual, I should indicate the table, for instance, like that:

LL.DataMember = "Products";

But a priori I don’t know what is the table to take information from and I did not find in your manuals or examples how to do it. Please, could you help me to figure out how to set programmatically DataMember?

Thank you in advance.

The JSON provider is special as you can only use the “outmost” table as label data source. What exactly does your JSON look like? Can you post an example both of your data and which part you’d like to use for your labels?

Hello Bartlau,
thank you for your reply and sorry for the delay in my answer.
Well, yes, of course, I will post an example of our json, but the goal is to be able to choose among all its tables from the designer :frowning:

Here is our json, I have been obliged to change its extension since the upload tool does not allow to upload json.

ewddata.txt (314.1 KB)

Just had a first quick look. Your JSON contains a number of arrays which are then parsed as tables in List & Label. A label project can only iterate one table, as it cannot contain tables itself. Can you give a concrete example which information you’d like to have printed on the label? This is the data structure as it is parsed on my end:
image

Hello Bartlau,
here is a concrete example.
We would need a label for every element of pieces array. We should use a field of parts2 but we could modify the json and duplicate this field inside pieces.
You think that’s possible?

That could be our start point, since the final goal should be to give the possibility to the user to select informations from another table, e.g. groups or prodlist.

If you set the DataMember to “pieces”, you should get the structure you want, e.g.:

JsonDataProvider provider = new JsonDataProvider(File.ReadAllText("ewddata.txt"));
ListLabel LL = new ListLabel();
LL.AutoProjectType = LlProject.Label;
LL.DataMember = "pieces";            
LL.DataSource = provider;

So in this case you have 3 labels in total, does that meet your requirement?

I found a way to pass this value programmatically, solving my issue.

Thank you Erdal.

1 Like

© combit GmbH