Page 1 of 1

Database variation with SDK

Posted: Sun Jan 26, 2020 11:31 am
by Reyu

I have a software written in c# to inspect labels. The idea is to go through a few thousand labels and find predefined errors which comes from user error at label editing, errors like specific object on the label is not the correct size or its rotation is wrong, etc.
I made a similar code for Nicelabel 6 with VBA but we upgraded to Nicelabel 2019 and I want to recreate the same app with the SDK.

So my problem is that I have a solution file which contains multiple labels, each label has database connections from an excel file.

I was able to open the solution with PrintEngineFactory.PrintEngine.OpenSolution() and open a specific label inside the solution with

But when I create a LabelPreview or try to print the selected label the objects with connected datasources are blank.
How can I tell Nicelabel which record or row I want to use from the connected excel?

The purpose is to be able to save a labelpreview or print the label if I detect an error, since the inspection is automatic and the user can check the label later.

I read through the SDK reference file but I was unnable to find a solution.


Re: Database variation with SDK

Posted: Mon Feb 03, 2020 4:51 pm
by Mytch

Easiest way is probably to just use a database filter on the label/solution that is qualified by some variable. This way, when filter is qualified, record is selected and usable in preview/print. Or, depending on how things are configured, you can have some database > variable mapping and make the variable Initial Value the value of the database field (assuming some record is retrieved by default). I don't think there are any native methods in API to help with Excel for this case.