-
Hello, I do have a fundamental design question. What is the best practice concerning the default mapping of data when it comes to dataSetRow[""] and row[""]? Suppose I have a dataset and a table, a grid or a expression in a data element that have access to this dataset. As I understand it: dataSetRow takes the value from the dataset, row takes it from the binding. If need a value from an outer element I need to use row._outer["abc"] and if I make a custom binding that adds two values (or does something else) I need to use row["abc"]. Let's take a data-element for example: I could do the expression like this:
or like this:
Both have the same effect. Which one of those is best practice for a simple mapping or for use in an expression? If I do not change the binding of abc in any way, it should always store the same value as the dataset. The visibility expression doesn't seem to be able to work with dataSetRow, why is that? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 5 replies
-
The standard way to access on scripting level is the usage of row[""]. The dataSetRow is specific to the "data"-element which is the default object on a table to access the columns of a dataset. |
Beta Was this translation helpful? Give feedback.
-
I think what @speckyspooky wrote is not quite correct. AFAIK it's like this:
Yes, this is best practice.
, e.g. in the output expression itself (dynamic text items), in visibility expressions, in onCreate events, in highlight rules.
Actually, when you drag and drop a dataset column or full table into the layout (or into a layout container of the master page), what happens is this: DnD of a whole dataset:
DnD of a dataset column COL (not quite sure, but that's my experience):
This works exactly the same for aggregations, the only difference being that when creating the binding entry in step 2, it asks you about the aggregation properties (e.g. which function, which group level) and will alway create a new binding entry. The only use case for using "dataSetRow" directly anywhere that comes to my mind is as follows: BTW I think that inside the event scripts of datasets, |
Beta Was this translation helpful? Give feedback.
-
Thanks for the fast replies, this cleared up all my confusion about the topic! 👍 |
Beta Was this translation helpful? Give feedback.
-
Sorry for reopening. I did just have some doubts about my understanding of the answers. Specificly about the paragraph where you talked about the usage of dataSetRow. You suggest to write bindings like this:
But should I still use:
To get to the data binding on an outer element. Ist that correct? I do expect dataSetRow to just go to next outer element that has a dataSet binding and look up the value there. It would never find it, if it were to be located in an element even higher up. |
Beta Was this translation helpful? Give feedback.
-
Maybe it's just the reports I work with, but we have if-else and similar things, that check other bindings, everywhere in our reports. We often piece together the blocks of texts that should be printed in data-elements or decide which binding to print, based on the value of multiple bindings. You say So it is correct to assume, that |
Beta Was this translation helpful? Give feedback.
-
Regarding I don't the distinction between trivial and non-trivial makes sense. Furthermore - but this is a question of taste - quite often I use complex expressions directly inside dynamic text items, and there I use |
Beta Was this translation helpful? Give feedback.
I think what @speckyspooky wrote is not quite correct. AFAIK it's like this:
Yes, this is best practice.
, e.g. in the output expression itself (dynamic text items), in visibility expressions, in onCreate events, in highlight rules.
Actually, when you drag and drop a dataset column or full table into the layout (or into a layout container of the master page), what happens is this:
DnD of a whole dataset: