This works as long as parentGun is set to the title of an existing tiddler.
However, the title of the existing tiddler is not in the parentGun field cause I can’t see how to set this field without user input. So I have stored the title in a variable and amended the statement to
from a tiddler with a unique ID and displaying a tabbed area, click on a tab titled ‘Map’ and from the viewtemplate for the Map tiddler, extract the values of the field, Longitude and Latitude from the parent tiddler so that I can render a map of the location.
The code I provided is the code in the viewtemplate.
The variable, parentgunID, definitely contains the title of the main tiddler cause if I display that variable, the crrect title is displayed.
I know I could just create a tiddler called ‘gunID_Map’ where gunID is the title of the main tiddler, but I am trying to avoid that and just have a single Map tiddler for all gun tiddlers.
This problem was the source of my questions related to Tiddler X Field Y value Z cause my initial idea was to store the main tiddler title in a field and then use it subsequently. But I cant get that to work either.
Ah, yes, sorry, my mistake. Editor mode is only switched on for accessing the wiki through the file protocol. Download it to your computer and then it should be ok except no images will be displayed.
Anyway, I have a solution to my problem. Not sure why I didn’t think of it before.
If I can store the parent tiddlers title, I can also store the value of the other fields in variables and then access them in the viewtemplate code. Obvious really. Just goes to show, you get focussed on one way and don’t see any other.
I have a work around. I’m still interested in a solution to the code as shown for my own education but recognise that people may be too busy.
If I could get the code to work, then I’d have a more generic solution that would cut down on the number of tiddlers in the final wiki by two thirds. And it would be more elegant.
Thanks everyone for your feedback. FYI, I tried to use the example following @EricShulman 's explanation in my other query (What is this example trying to explain - #4 by Bob_Jansen) but got nowhere. So instead of continuing to bash my head against a brick wall, I implemented my simple solution, storing needed values from the main tiddler in variables before actioning the various tabs in the viewtemplate and then displaying the variable values. Works a treat!.