How can I access the [row_key] that fired a specific PDF_creation for scheduled reports inside start: expressions?
I run a scheduled report for each row in table (+condition) I can access the values of the row that invoked the PDF_Creation by using [_thisrow].[row_key] but when I use start: expressions [_thisrow].[row_key] now refers to the table that is used inside the start.
How can I select the [_invoking_row_key] inside of Start: expressions?
-thx
@Jonas using a de-ref expression without a dot in between should fetch it, i.e.
[RelatedTableRefColumn][Row_Key]
Table_A = invokes PDF_create Table_B
= used for start: expression
between A and B there is no ref_column.
So I donโt see how I can really use what youโre suggesting.
@Jonas I thought that you have ref between 2 tables, therefore I proposed that. Without a ref, may be you can fetch the ID with ANY(SELECT(โฆ)) expression. But of course this will only work if you have some kinda connection (not ref) between 2 tables.
You are right, your example works for the select of the start expression. The problem occurs, once we are inside of it.
Try this and you will see that you cant get out of the start expression.
edited_ Report For monthly_drivers
driver: <<[driver]>> year: <<[year]>> month: <<[month]>> is_ready: <<[is_ready]>>
<<Start: SELECT(tours[id],[_THISROW].[month]=โJanโ)>>
is_ready: <<[_thisrow].[is_ready]>>
<>
-------------------- I also tried using the column name alone without the
[_thisrow] but then I get โcouldnt find columnโ
Hi Jonas,
Thanks for the clarifying images.
You wrote โHow can I access the row of โmonthly_driversโ that triggered the workflow inside the start: expression? [_THISROW].[month] does not work since it looks inside of โtoursโ instead of โmonthly_driversโโ.
Actually, when [_THISROW] appears inside a Start expression like the one below, it refers to the current row of โmonthly_driversโ. Admittedly, the term [_THISROW] is a
bit confusing, but it is referring to the current row of the table containing the Start expression. That is โmonthly_driversโ in your example.
To verify this, I did the following: 1. I created two tables that contain the fields listed in your image.
I created a Report for table โmonthly_driversโ that specifies โFor each row in tableโ.
I created a Body template that contain the test template shown below.
I saved and verifying the template.
I ran the Report
Report For monthly_drivers
driver: <<[driver]>> year: <<[year]>> month: <<[month]>> is_ready: <<[is_ready]>>
<<Start: SELECT(tours[id],[_THISROW].[month]=โJanโ)>>
Driver1: <<[driver_1]>> Driver2: <<[driver_2]>> Driver3: <<[driver_3]>> Driver4: <<[driver_4]>>
<>
The Start: SELECT expression condition I specified is not realistic, but it confirms that [_THISROW] is referring to the current row of โmonthly_driversโ and that it retrieves the value of the โmonthโ field in that row.
Forgive me if I have misunderstood what you are reporting. If so, please do the following:
thatโs unfortunate,
thy
Hi Jonas,
If you want to refer to fields in the parent record from within the embedded template of the child record, the child record must contain a Ref field that refers to the parent record.
In your case, you need a Ref in the โtoursโ table that refers to the parent record in the โmonthly_driversโ table.
If that Ref field was called โmonthly_driver-refโ, then within the embedded template for the โtoursโ table you could access the โis_readyโ field in โmonthly_driverโ by specifying:
[monthly_driver-ref].[is_ready].
[_THISROW] is only defined within the right hand side of the SELECT expression where it refers to the parent record.
[_THISROW] is not defined within the embedded template. As you noted, specifying [_THISROW].[is_ready] will not return the value of the โis_readyโ field in the parent record in the embedded template.
Instead, you need to use a dereference expression like [monthly_driver-ref].[is_ready].
If you are referring to the [row_key] inside a SELECT expression, then you should specify [_THISROW].[keyA] to refer to the key of table A.
For example:
Start: SELECT(B[keyB], AND(IN([keyB],[_THISROW].[RefColumnInAThatRefersToB]), [SomeFieldInB]=โActiveโ))
In a SELECT expression, the table you specify in the first part of the SELECT (in this case โB[keyB]โ) determines which table is the current table in the second part of the SELECT expression.
For example, if you want to refer to a field in B in the second part of the SELECT expression, you simply specify the field name from B. In the example above I refer to [SomeFieldInB].
If you want to refer to a field in A in the second part of the SELECT expression, you specify [_THISROW].[SomeFieldInA]
SELECT and FILTER are special because the first part of the SELECT picks the table that is used as the default table throughout the second part of the SELECT expression. In the second part of the SELECT expression [_THISROW] is used to refer โup to the parent tableโ.
@Levent_KULACOGLU @Philip_Garrett_Appsh thank you for your answers. I understand the select() and how I can use table A & B to connect within that statement. My scenario is that I want to get the specific row that invoked the PDF.
Please check out these 2 attachments, they are a bit simplified but visualize the situation.
User | Count |
---|---|
39 | |
28 | |
23 | |
23 | |
13 |