I have a data object called “AccreditationBodies” made from string Name and Image Logo. Edit: we have many of these in our overall report model where some have the same name.
What I would like to do is pull out a single item where the Name is equal to “B1” into a User Variable. I currently have it set up as a Report container that filters by “B1”. This works but the issue is if there are 5 “B1” entries, a report is generated with 5 pages where the 1st page contains the correct data and the remaining 4 just contain the Logo image. Even if I try to Distinct this into 1 entry, it will not work if the report goes over 1 page, the logo is only printed on the first page (needed for the second etc)
Thanks
Edit: I have tried using Script$ but I cannot work out if there is a way to loop through the entries.
It looks like you’re currently solving the data-selection problem with design/layout logic (a filtered report container), which is why you end up with multiple pages and the logo only on the first page of the container, not on all report pages.
From the context we have, there’s unfortunately no documented, ready-made LL function that would “search a collection of fields and return a single entry as a user variable” in the way you describe. From the documentation:
→ Fields only exist in the context of a report container / table, and are evaluated per record.
→ Variables (including user variables) are evaluated outside the report container and are not tied to each data row in the same way Variables, Fields and Data Types, Objects and Reportcontainer in Designer. https://docu.combit.net/progref/en/index.html#!Documents/variablesandfieldswithdatabinding.htm
You could use an approach similar to our invoice examples. In our Demoapplication, just look for the samples with “invoice…”.
Other typical, documented approaches are:
Prepare the single record in your application or data source
For example filter or aggregate your AccreditationBodies data in code (or SQL) so that List & Label only receives one row for “B1”, e.g.:
In SQL: SELECT TOP 1 * FROM AccreditationBodies WHERE Name = ‘B1’ ORDER BY …
In .NET: LINQ on your collection before passing it to LL.
Then:
Use the Logo field from that 1-row data source wherever you need it (e.g. in a picture object for the logo on a page header).
Thanks for the response. I have ended up storing the logo in our data model as it’s own field. I then assigned this field to a UserVariable that can be used any where on the report.