Migrating from BDE-based L&L to FIREDAC-based L&L

Hi,

I am migrating a Delphi application from BDE-based L&L components to more modern FIREDAC-based components, but I am encountering some problems.

For example, I can’t find a way to dynamically add database tables in a similar way as before, because I can’t find the LlDbAddTable function. I can’t find anything like LLCreateSketch either.

Are these functions no longer available or where should I look for them?

Thank you very much and best regards.

PS: I have read that in order to know how the FIREDAC component works, it is recommended to consult the .NET component help, as its behaviour seems to be similar, but while these functions are available from the ListLabel29.Core property in .NET, in Delphi I can’t find them.

PS2: I also find that the procedures ListLabel29.Print or ListLabel29.Design aren’t override to take parameters anymore (like projectType, projectFile, etc), although in the .NET documentation and the Programmer’s Manual both make mention of them. Am I doing something wrong?

If you use the FireDAC component, you no longer need functions such as LlDbAddTable, as this is taken care of by the component. Otherwise, you are welcome to extend the core object yourself and submit PRs to GitHub if necessary GitHub - combit/DelphiDataProviders: combit List & Label Additional Data Providers for Delphi.

Thanks for the answer, although I would still like to be able to manually manage certain aspects of the component, as I had thoroughly adapted the functioning of the previous one to my workflow in my application and changing everything now is no minor problem… Is there no way to replicate a similar performance?

Also, could you please tell me where I can find a more specific documentation for the Delphi component based on Firedac? The help of the .NET component does not really work for me because so far when I have gone to it with a specific doubt I have found that the behaviour does not match exactly with the behaviour described in the source code of the Firedac component itself, like with the Print or Design procedures.

Sorry for the inconvenience and thanks again.

Unfortunately, we do not currently have any further documentation on the Delphi component based on Firedac. What problems do you still have in mind, or what is still unclear? The core object should not be too difficult to extend on the basis of the existing functions.

Please ignore this post and move on to the next Reply
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Hi and thanks again for your answer.

So far I’ve made some progress in adapting my project to the new components, but I still have some basic problems that I don’t quite understand, like I’m having problems with the connection between the component itself and the database tables. With the BDE component the relationship between the component and the tables was done manually, in unbound mode, and now I am encountering very basic difficulties to properly connect everything.

For example, I need to print a series of labels, one for each record in a table, into a page, something very simple as you can see.

  1. I have the data of the different Labels in one DataSet.
  2. The data fields of the DataSet are included in the Label file as Variables.
  3. I connect this dataset via a DataSource to the TListLabel29 component in TListLabel29.DataController→DataSource.

(At this point, if I print the List&Label as it is, it only prints a single label in the page, the first one, but ignores the rest of the labels stored in the DataSet.)

  1. I’ve found that if I go to the DataController→DetailSources property and add a DetailSourceItem (even though there is no MasterDetal relationship because I only have one table) and set its DataSource as the same as the one I have linked in the component itself as DataController→DataSource, when printing, as many labels appear as I have in the DataSet table, but all of them show the same data: the first label.

So now the number of labels that are printed is correct and they always coincide with the ones I have in the table, but the information shown does not go through the records of the table, it only accesses the first one.

To be honest, I’m a bit lost. Obviously I’m doing something wrong, what do I need to implement to show the information of all the records properly, one label for each one, all in the same page?

Sorry for the trouble, but any help would be appreciated :sweat_smile:

Thank you very much.

P.S: Before the migration, in the BDE-based component, I used the OnDefineVariables event to load the unbound data into the corresponding variables and then do Next to the DataSet, which left it located on the next record, but I can’t find any similar event in the FireDAC-based component. There is AutoDefineNewPage, which is only triggered when a new page starts (so all the labels in the page are the same) and AutoDefineNewLine, which is triggered when processing Fields, but not Variables (which is what I need for the labels).


EDIT: I have found that the reason why the data is repeated in all the labels is that what is being displayed is the content of unbound variables that were defined only once, so their content never updates.

What I don’t understand is why I need to incorporate a DetailSource to recognise the different fields and records in the table. I thought it was only necessary when you had more than one table and in Master/Detail relationship. If I just assign the DataSource in the DataController, but not the DetailSource, no field from the table is available at the Designer and the printing does not recognise any records.

I realise now that the previous post can be a bit confusing and complicated. Due to time constraints I was redacting it as I came across some of the problems described and did not think it through enough before posting, so if you don’t mind I will summarise the specific issues I have encountered so far so that they can be better understood:

  1. In a LABEL project, I link the component TListLabel.DataController.DataSource with the DataSource of a DataSet where I have the information of the labels, but in the Designer no variable appears available in the Variables List nor when printing it recognizes any data of the table. It does recognise it if, in addition to the TListLabel.DataController.DataSource, I link a TListLabel.DataController.DetailSourceItem.DataSource with the same DataSource. Is this a normal behaviour and do I need to define a DetailSourceItem when I only have one table without relating it to any other table?

  2. I would need to be able to define some unbounds variables that do not come from the database but are calculated dynamically. Before, in the BDE-based component, I used the OnDefineVariables event, so that every time the variables of a record were loaded I could define the content of these unbounds variables for that specific record, but I see that in the FireDAC component this event is not available. There is the OnAutoDefineVariable, which is triggered every time each variable is defined, and the OnAutoDefineNewPage, which is triggered every time a new page is started. I would need some way to define these unbounds variables every time all the variables of a new record are defined, not with the definition of each one of its variables nor with the change of a whole page. Is this somehow possible?

  3. In my project the variables and fields with which users can design their labels and reports are custom named, depending on the language of the computer where the application is running. Is there any way to rename the variables and fields that L&L gets automatically from the DataSource to manage the name with which it appears to the user? At the moment I have thought of using the OnAutoDefineVariable and OnAutoDefineField events, which evaluate the VariableName and FieldName parameters and can modify them at the moment of their definition, but it means that in the definition of each field I have to compare its original name with all the available field names in order to replace its name with the correct custom name. Is there a more efficient way to achieve this?

Once again sorry for the troubles and please ignore the somehow erratic previous post, I think in this post the doubts are more precise and understandable.

Thanks and any help will be appreciated.

Best regards.

  1. I have tried to reproduce this with our FireDAC DataSet Databinding sample:

    ListLabel.DataController.DataMember := ‘’;
    ListLabel.AutoProjectType := TLlProject.ptLabel;
    ListLabel.Design;

    This has worked so far. The top table in the dataset was then registered with variables. With “DataMember” you could still specify the table if there are several. Can you try this with the example? Or you can provide your own example.

  2. The event “AutoDefineNewPage” should actually be called per label and not per page for a label project. We will take a closer look at this.

  3. The LL dictionary would be suitable for this. However, this has not yet been implemented in the FireDac component. We have added this as a feature with a higher priority. I will keep you up to date here.

Hi again and thanks for the reply.

  1. Yes, I have been consulting the Sample project and yes, changing the Project type to Label shows the fields of the first of the tables declared in the DetailSourceList as variables, but that was not exactly my question. The situation I’m asking about is when you don’t have any DetailSource declared in the DetailSourceList, that is, when in your project you only have a single table to access and you define its Datasource directly in the DataController.DataSource property, but without registering any item in the DetailSourceList (I had understood that DetailSourceList was only used for Master/Detail relationships between two or more tables). In this case the ListLabel control does not connect with the corresponding DataSet and does not show any of its fields in the Designer (in fact in the Sample referred, if we delete the content of the DetailSourceList, the connection with the data is lost even if we have correctly linked the DataController.DataSource). My question is: Is this the normal operation of the control? Is it necessary to always declare at least one DetailSource in the DetailSourceList even if we only work with a single table without any relation to any other table whatsoever?

  2. Thanks, at the moment in the different tests I have done, this event is only triggered once per page, regardless of the labels it contains. If this event was triggered with the printing of each label in a Label Project, it could be a solution for me.

  3. Thank you, I will take a look at the Dictionary in the documentation and I’ll wait for it to be included in an update whenever possible.

Again thanks for your help. Best regards.

  1. This may be a little unfortunate, but it is by design. You need to define a DetailSourceItem when you only have one table without relating it to any other table.

  2. We have found the cause and have made a corresponding change. Please download tomorrow the current LatestPrerelease Service Pack.

Thank you very much, I’ll try it as soon as I download it.

Best regards!

Hi, I have finally been able to test the latest Prerelease Service Pack to check the performance of AutoDefineNewPage, but I think its still not working as it should…

In your answer you said:

But as far as I have seen it seems that it is now called both per label AND per page, so as soon as the project has more than one page, the calls to AutoDefineNewPage are out of sync with respect to the labels printed. For example, if there is only 1 label on each page and I have to print 3 labels, I find that the event is actually called 5 times (once for each label and once for each extra page)

  1. First label.
  2. (New Page).
  3. Second label.
  4. (New Page).
  5. Third label.

Shouldn’t it be called only 3 times?

We will review and, if necessary, correct this issue. We apologize for any inconvenience caused. The event should indeed be raised only once for each label, not for every page break.

Thank you very much, I’ll really appreciate it.

The fix has just been committed. You should be able to download the latest prerelease service pack tomorrow morning. Thanks for pointing out this issue.

I have already tested it and now it works perfectly as described, one call for each Label but none with the page change.

Thank you very much!

1 Like