Dynamically Reference Fields from Another Tiddler Based on Title of Current Tiddler

I’m dabbling in things I don’t fully understand here, but I feel like I’m close to figuring it out and just missing something.

I want to call a field from another tiddler, where the title of the target tiddler is based on the title of the current tiddler. For example:

  • Current Tiddler: John Smith
  • Target Tiddler: John Smith Profile

I want to render and return, for instance, “Dallas, TX” from a field in the target tiddler.

I’m trying to achieve {{John Smith Profile!!emplocation}}

Here’s what I’ve tried so far:


<$wikify name=wikifiedProfileTest text="{{!!title}} Profile!!emplocation">
<<wikifiedProfileTest>>
</$wikify>

But instead of rendering the location, it just outputs “John Smith Profile!!emplocation” as plain text. I thought the “wikify” mechanism would handle this, but I obviously don’t fully understand its purpose. I also tried adding the curly brackets around it, but that didn’t seem to work either.

Broader Context

What I’m trying to achieve is to maintain separate tiddlers for people and their related profile information. For instance:

  • The main tiddler for a person tracks historical information.
  • A separate profile tiddler contains details like employee location, ID, title, etc., which are updated on occasion.

This setup allows me to import new JSON files to update profile data without overwriting the original employee tiddlers. I’d like to use a viewtemplate to display these profile fields dynamically within the main person tiddlers. While I’m more comfortable with setting up viewtemplates, integrating the fields dynamically has me stumped.

Can anyone help me figure this out or tell me if I’m approaching this the wrong way?

I’m afraid I don’t have the TiddlyWiki version readily available, but I had started that file in 2018.

Try this:

<$let location={{{ [{!!title}addsuffix[ Profile]get[emplocation]] }}}>

or perhaps:

<$let target={{{ [{!!title}addsuffix[ Profile]] }}}>
<$let location={{{ [<target>get[emplocation]] }}} ID={{{ [<target>get[empID]] }}}>

-e

1 Like

Thank you so much!

I wasn’t able to use $let on the wiki I was using, but I applied the above with $set and came up with:

<$set name="employeeid" value="{{{ [{!!title}addsuffix[ Profile]get[empid]] }}}" >

It works great!

I realized however that I don’t need every category to be wikified (for example, having the location wikified is great, but I don’t need really need to wikify the ID). It’s not a big deal if they are all wikified, but there’s that part of me that wants to know how to do both.

I tried removing the curly brackets, but that didn’t work, of course. I just get [{!!title}addsuffix[ Profile]get[empid]] returned. I tried experimenting with $text, but got similar results, or simply “true” as a result.

Any help on this next step?

To retrieve the empid value, you shouldn’t use double quotes around the filtered transclusion syntax.

<$set name="employeeid" value={{{ [{!!title}addsuffix[ Profile]get[empid]] }}}>

To wikify a value, you can use $wikify instead of $set, like this:

<$wikify name="location" text={{{ [{!!title}addsuffix[ Profile]get[emplocation]] }}}>

note that this will produce plain text output. If you want to preserve formatting (e.g., bold, italic, etc.), then add the output=formattedtext or output=html parameter, like this:

<$wikify name="location" text={{{ [{!!title}addsuffix[ Profile]get[emplocation]] }}} output=html>

-e

Wonderful! I’ll have to experiment with these, thank you!