How can I access the [row_key] that fired a s...

Jonas
New Member

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

0 10 357
10 REPLIES 10

@Jonas using a de-ref expression without a dot in between should fetch it, i.e.

[RelatedTableRefColumn][Row_Key]

Jonas
New Member

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.

Jonas
New Member
 

Jonas
New Member

@Philip_Garrett_Appsh

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โ€

@Jonas

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.

  1. I created a Report for table โ€œmonthly_driversโ€ that specifies โ€œFor each row in tableโ€.

  2. I created a Body template that contain the test template shown below.

  3. I saved and verifying the template.

  4. 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:

  1. Create an simple sample app that illustrates the problem. 2. Provide me with: 2a. Your account id from the Account pane 2b. The app name 2c. The steps to reproduce the problem.

Jonas
New Member

thatโ€™s unfortunate,

thy

@Jonas

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].

@Jonas

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โ€.

Jonas
New Member

@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.

Top Labels in this Space