Using a form's SelectWidget to retrieve multiple fieldValues

In effort to set up a form to create transactions.

In need of a functions/macros to retrieve multiple field data from a single selected Tiddler.

Case Scenario in my best pseudo articulation.
suppose a filter can list a group of tiddlers either tagged as vendors (i.e tag=vendor) or my preferred way of clustering tiddlers by a fieldName (i.e group=vendor). Each tiddlerVendor represent an individual merchant containing the following fieldValues:

vendor.contact.business.name	
vendor.contact.business.payee.name	
vendor.contact.business.phone
vendor.customer.identification.number
vendor.merchant.identification.number

In a tiddlerForm, users need to fill-out a few <$edit-text/> questions (i.e amount, discount, purchase.date, purchase.item); and select one tiddlerVendor (a merchant), from that vendor group list and/or the tagged list; upon selection, it retrieve all those multiple fields; to display it on the tiddlerForm (so that the user can see his/her selection data).

Finally a buttom to create a new tiddler with a unique dynamic title such as <<now "Entry#YYYY.0MM.0DD:0hh:0mm:0ss">>

  1. who’s fieldData is populated with the data collected from the <$edit-text/> form questionnaire (i.e amount, discount, purchase.date, purchase.item)
  2. Along with the multiple field names (listed above) populated by the data collected from that one SelectWidget merchant choice.

You don’t need any new functions or macros for this. I don’t have much time now to model all of what you’re asking for help with. But using a select widget to let someone choose a vendor — and then having various field values for that vendor show up (formatted however you like) is fairly simple.

You just need to name a tiddler (usually a system tiddler, perhaps temporary in $:/temp namespace) to hold the selected vendor. Then you can transclude values from there, and use them in your button actions as desired.

Here’s a simple model of choosing from a menu, and seeing the field values display (conditional on that selection), which you should be able to adapt to your needs: Biblio-Springer — working on automatic author template

1 Like

For us non-programmer who copy/paste code hoping to tweek our way into a tiddlywiki solution; your recommended link was a fine pick of an example; useful/educational/tweekable.

I dragged the tiddlers involved to a clean notebook (tiddlywiki.com) to isolate its functionality; the variables seem to be called effectively except for the ImageWidget which only transclude external images; this snippet of code can only point to the URI of an image.

<$tiddler tiddler={{$:/temp/currentChoice}}> 

<img style=float:right;padding:20px 20px 10px 40px; width=150px src={{!!image-url}} />

</$tiddler>

I went to the selected tiddler’s field image-url and experimented with every possible image location address syntax I can find to no avail; I don’t understand the handing of images enough to make this work; I keep breaking this code’s function every time I try.

How can this code be edited to serve its function except using imported or embedded images?

Once you select a tiddler as a source, the new button can simply contain action widgets that set the fields to fieldname={{!!fieldname}}. If you structure it in a particular way, you can use the action widget ActionSetMultipleFieldsWidget

My issue with action widgets it seems to only want to function with explicit constant variables; when I try the tiddlywiki’s examples but with a widget, as a value, with the objective to create a new tiddler with a unique dynamic title that uses some “random number creator” (if one exist) widget/function" or my clever solution: <<now "Entry#YYYY.0MM.0DD:0hh:0mm:0ss">> seems to fails to take the value; sometimes it reads it as a string/does nothing/breaks the function.

I understand why this is proving difficult for you. It was the same for me when I started using tiddlywiki.

But to be clear;

  • As a rule you cant use widgets as values of a parameter. You can use variables, functions, transclusions including fieldnemes. Not widgets.
  • There are some cases where you cant use macros \define and \procedures as values to a parameter but there are ways around that, which are best avoided.
  • There is a trick you can use, to make use of the output of a widget as a value to a parameter. Put the widget in a field or tiddler which you then transclude.
    • I am still researching this trick, otherwise you need the not-recommended wikify, to wikify something and set a variable to the result.

Help putting the solution into syntax.

A population of tiddlers grouped by a field value tiddler.data='ledger' each containing the following field data:

tiddler.data ledger.number ledger.title ledger.class ledger.description

in a new tiddler a syntax has a variable ID value

{{$:/temp!!ledger.number}}

how can I syntax a filter run where i can use the value of that variable to find the tiddler matching that unique ledger.number among the tiddler.data='ledger' group in order to access that identified tiddler’s fields?

1 Like

Perhaps something like this will do:

<$tiddler tiddler={{{ [all[tiddlers]tiddler.data[ledger]ledger.number{$:/temp!!ledger.number}] }}}>
{{!!ledger.title}}
{{!!ledger.class}}
{{!!ledger.description}}
</$tiddler>
1 Like