SID-01444: Can a formfield name be search or display
| Status: |
Answered |
TWiki version: |
5.1.1 |
Perl version: |
|
| Category: |
CategorySearch |
Server OS: |
ubuntu server |
Last update: |
13 years ago |
Good day!
I was wondering, if a formfield value is identified and use it to search in other topics. And in that resulted topic the formfield value has a different field name, can the field name be display in the result?
thanks
--
MichaelSevero - 2012-04-12
Discussion and Answer
You can use a nested search, see example at
FormattedSearch.
Alternatively, you can use the FORMFIELD variable. Lets say you search for a list of topics that have a form filed called "Team", and that field lists a topic that has a form called "Members". You can list the topic, the team field, and all members as follows:
%SEARCH{ ... format="| $topic | $formfield(Team) | $percntFORMFIELD{ \"Members\" topic=\"$formfield(Team)\" }$percnt |" }%
The
% of the FORMFIELD variable is escaped wih
$percnt so that it fires once per search hit.
Details in
FormattedSearch,
VarSEARCH,
VarFORMFIELD.
--
PeterThoeny - 2012-04-12
oops!
Sorry for not clarifying my question (not good in explaining hehe) I will use your example with slight difference:
i want to search for john doe . It resulted in topic A with a form "Team" and John doe is the value of or corresponds to formfield(Captain)
now..
what about if a guy search(VARsearch) for john doe without knowing his background as Captain ( $formfield(Captain) ), can guy still search for john doe and display the the "field name" that it correspond to which is Captain?
hope that is clear
thanks
--
MichaelSevero - 2012-04-12
Sorry, I misunderstood your question.
It is possible to search for "JohnDoe" in form fields, a simple search finds main page content and form data.
I am not aware of a ready made query to show which form field contains the name searched for. You can however use conditionals do do that. Untested example:
format="| $topic | Found in: $percntIF{ \" '$formfield(Captain)'='JohnDoe'\" then=\"Captain\" }$percnt $percntIF{ \" '$formfield(Lieutenant)'='JohnDoe'\" then=\"Lieutenant\" }$percnt |"
Related:
QuerySearch,
IfStatements,
VarIF
--
PeterThoeny - 2012-04-12
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.