Tags:
create new tag
view all tags

SID-01487: Access the $formfield of a child through a %SEARCH%

Status: Answered Answered TWiki version: 4.1.2 Perl version:
Category: Server OS: Last update: 13 years ago

Hello,

I have a database of vehicles. I have cars and engines that are in the database. I have an engine as a child of a car. I have a %TABLE% that I am populating using %SEARCH% to search for cars and $formfield to find the specific field I want. I would like to also pull some $formfield data from the child engine of the cars that are being searched. I can't hardcode the child $formfield because there are multiple cars that have engines and each car may/may not have an engine.

I am able to %SEARCH% for the engines and pull the parent $formfield data but this technique generates some problems that I would rather not deal with.

Any help is appreciated

-- JohnRuiz - 2012-06-13

Discussion and Answer

You can use VarFORMFIELD. Say you have an engine XYZ with 2000 CC. To query the CC, use %FORMFIELD{ "CC" topic="XYZ" }%. To query this in a SEARCH format you need to escape the variable:

format="| ....| $percntFORMFIELD{ \"CC\" topic=\"$formfield(Engine)\" } |"

You could also check if the Engine form field is set using an escaped VarIF. However, and empty topic="" in FORMFIELD will default to the current topic (the one of the query). Since that topic has no form field called CC it will show nothing, which is likely what you want. So ou can simply ignore the empty field case.

-- PeterThoeny - 2012-06-18

      Change status to:
ALERT! 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.
SupportForm
Status Answered
Title Access the $formfield of a child through a %SEARCH%
SupportCategory

TWiki version 4.1.2
Server OS

Web server

Perl version

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2012-08-02 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.