Page 1 of 1

Reference a source meta field in a fact definition

Posted: 20 Apr 2023 21:14
by JoopvB
What is the easiest way to refence a meta field in a fact definition?

Re: Reference a source meta field in a fact definition

Posted: 20 Apr 2023 21:31
by tatewise
I guess you mean in a Sentence Template and are referring to Templated Source Citation metafields?
The complication is that the Fact can have multiple Source Citations, so you must cater for %FACT.SOUR[1]...% and %FACT.SOUR[2]...% and %FACT.SOUR[3]...% and so on for as many Citations as might exist, unless you can be sure that the metafield will always be in the 1st Citation.

It also depends on whether it is a Citaion-specific metafield or a Source record metafield.
The format for the metafield shortcut is given near the end of Understanding Data References.

So if it is a Citation-specific Text metafield called Type then the data reference is:
%FACT.SOUR[1].~TX-TYPE%

If it is a Source record Date metafield called When then the data reference is:
%FACT.SOUR[1]>~DT-WHEN%

Note the > link to the Source record instead of the dot for a Citation.

I have not double-checked those data refs but fairly sure they are correct.

Re: Reference a source meta field in a fact definition

Posted: 21 Apr 2023 09:54
by JoopvB
I have a single source with the meta fields NUMMER (text) and TYPE (enumerated). My goal is to reference both fields in a fact sentence definition.

Following your advice I tested {%FACT.SOUR[1].~TX-NUMMER%} and {%FACT.SOUR[1]>.~EN-TYPE%}. The first one shows nothing (although the "nummer" exists) and the second one shows {%FACT.SOUR[1]>.~EN-TYPE%}.

What am I doing wrong?

Re: Reference a source meta field in a fact definition

Posted: 21 Apr 2023 10:14
by tatewise
JoopvB wrote:
21 Apr 2023 09:54
What am I doing wrong?
You have not studied my examples closely enough! :D

Explain to me your reasoning for using dot [1].~ in one case and > dot [1]>.~ in the other.

Re: Reference a source meta field in a fact definition

Posted: 21 Apr 2023 19:17
by JoopvB
Sorry Mike, no reasoning (or maybe old age :)).

{%FACT.SOUR[1]>.~EN-TYPE%} is obviously wrong. But, how about {%FACT.SOUR[1].~TX-NUMMER%}? That should provide NUMMER shouldn't it?

Re: Reference a source meta field in a fact definition

Posted: 21 Apr 2023 19:27
by tatewise
Depends on where NUMMER is. Is it a Citation-specific metafield or a Source record metafield?
See my two formats and the note about > versus dot.

Re: Reference a source meta field in a fact definition

Posted: 21 Apr 2023 19:30
by JoopvB
It's a source field and that's what I did wrong, {%FACT.SOUR[1]>~TX-NUMMER%} work like a charm.

Thanks!