New Bug Encountered: The given key was not present in the dictionary

I have a workflow to save a file.
In the File Name Prefix I had this formula and it was working for some months:

<<Titel>> <<SUBSTITUTE((IF(ISBLANK([Wohnung]) , [Kunde].[Kunde] & " " & ANY(SELECT(Verwalter[Nachname] , IN([Key] , SELECT(Ansprechpartner[Ansprechpartner] , AND( ISBLANK([Wohnung]) , [Kunde] = [_THISROW].[Kunde] , IN([Funktion] , LIST(Mieter , Eigentümer))))))) , [Wohnung].[Wohnung] & " " & ANY(SELECT(Verwalter[Nachname] , IN([Key] , SELECT(Ansprechpartner[Ansprechpartner] , AND([Wohnung] = [_THISROW].[Wohnung] , IN([Funktion] , LIST(Mieter , Eigentümer))))))) & " " & IF(ISBLANK([Wohnung]) , INDEX(SPLIT([Kunde].[Adresse] , ",") , 1) , INDEX(SPLIT([Wohnung].[Adresse] , ",") , 1)))) & " " & [Anlagenkomponente].[Produktbezeichnung gesamt] & " " , "/" , "_")>>_<<PDF>>

Now I wanted to change the formula and went into the Expression Assistant.
Without changing the formula the editor says:

could not be parsed due to exception: The given key was not present in the dictionary…

The same formula is working in a VC. (of course without the <<>>)
So I created a VC [Prefix] and use this VC in the File Name Prefix.

But perhaps you can take a look.

Is “Titel” correct?

Im getting this bug too

FilenamePrefix

According to the documentation here, this should work

That document is for template files, not expressions in the Expression Assistant. Routing <<OrgUnit>> is not valid in either template files or expressions. The error message reflects this, just not clearly.

I respectfully disagree. I am not referring to the content of the template file, but the filename of the file generated when the template is filled out (which is working perfectly, by the way). Hence “File Name Prefix”. And the help page I linked to specifically indicated that it should be possible to use expressions of <> in name of the file. See screenshots below:

Routing <<OrgUnit>> is not a valid expression, nor is it what the screenshot you provided shows. The expression in the screenshot, CONCATENATE("Routing", [OrgUnit]), is valid.

Dear Steve

Please see this help article, second half of the page:
https://help.appsheet.com/en/articles/2848415-creating-and-saving-a-file-from-a-workflow-rule-or-scheduled-report

When I use the column name “[OrgUnit]” the value does not appear in the filename when the report is actually generated. Although when I test the expression “CONCATENATE(“Routing_”, [OrgUnit])” in the expression builder it tests correctly.

You already know what happens when I use the angle brackets, as directed by the AppSheet help article.

Its a bug.

CloudApp

So, I noticed that the documentation for File Name Prefix was changed so that now it reflects how appsheet actually works (aka, a bug). Were you the one to change the documentation @Steve?

It would have been nice for you / appsheet to say “yes, its a bug” or “we got the doc wrong and we’re going to change it”

There is still a bug in File Name Prefix.

When I use the column name, it does not appear in the name of the file when the report is generated.

When I test the expression CONCATENATE ( “SomeName_”, [ColumnName] ), the [ColumnName] appears in the test expression. But it does not appear in the report name when the report is generated. See video below:

CloudApp

I was the one that updated the docs because they didn’t match the current behavior. I will update them again to show a better example, but the (admittedly overly-complex) behavior we have currently is that you can still use the angle-bracket syntax but you need to use an expression to generate it. So for example, "SomeName_<<ColumnName>>" works but SomeName_<<ColumnName>> will not.

1 Like

Im sorry, but Ive tried various combinations (as you can see in the next video) and I cannot get it to work. I dont want an overly complex expression in the filename, just the column that represents the organisational unit.

The file contains GPS coordinates for different organisational units, and it is the input file to a Google Apps script that will plan routing. Since each org unit covers a different geographical region I cannot use a generic filename.

CloudApp

I understand this is confusing because there are two-level on expressions, but try your first example "StartStopPoints<<OrgUnit>>" on creating a real file (you can use the test button on the workflow) and that should work with the correct file name. The test button you used is only to test the expression.

Below is where the run/test button I encourage you to try is located:

1 Like

I havent tried it yet, but no can do. I notice from the screenshot you posted you suggested generating the file from Worflow tab -> Save File option. As far as I know the File Name Prefix from here has always worked. But trying from the Reports tab -> Save File option gives the problem. I am trying to generate a JSON file from two different unconnected tables. Workflow Save File only allows access to one table, but at least I can define the trigger, in Reports Save File I can specify which tables the template runs on, but it runs on a time-based schedule.

Let me see if I can figure out another way to achieve the (sub)goal of generating an input file.

Hi David,

If I understand you latest post correctly, you are saying:

  1. In a “Save File” Workflow Rule you can refer to a field name when specifying a “File Name Prefix” expression.
  2. In a “Save File” Report you cannot refer to a field name when specifying a “File Name Prefix” expression.

That is correct, because in a Workflow Rule there is a “current record”. The “current record” is the record that is being added, updated, or deleted. It is the record that triggered the workflow rule. When you refer to a field in the “File Name Prefix” expression, the field name and the field value you are referring to is coming from the “current record”.

For a Report there is no “current record”. The Report is triggered by the scheduler but there is no “current record”. The Report always starts “de novo” with no “current record”. As a result, you cannot refer to a field name or field value in the “File Name Prefix” expression from the “current record”.

This difference between Workflow Rules and Reports also affect how you write templates. Since a Workflow Rule has a “current record”, your template can refer to field names and field values from that record in you Workflow Rule template.

By contrast, in a Report template there is no “current record”. Your Report template must begin with a Start expression that retrieves the record or records you wish to display.

In your report, it might be possible to write an expression that retrieves the “OrgUnit” by some means. However, that expression cannot assume that it is starting from a “current Record”, because there is no “current record” for a Report.

1 Like

Ok, thanks for this answer. What you said makes sense. I have indeed found a resolution, using the Workflow Rule and a json template. However, I make use of <> and <> tags to cycle through all the relevant records in on the trigger table, then I use a SELECT to fetch a single row with org unit info from a different table. It works quite well.

My original Post seems to be fixed. Thank you.