KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Being able to compile and support the use of an optional 4D Component
PRODUCT: 4D | VERSION: 12.3 | PLATFORM: Mac & Win
Published On: December 16, 2011

When writing a component it can be a real hassle, when the use of the component is optional, to have to go through and remove all references to shared methods to be able to get the database to compile when the component is not installed.

The code below demonstrates how to write code that supports the use of an optional component and being able to compile when the component is not installed.

  // Get the list of installed components
  //{

ARRAY TEXT($Components_aT;0)
COMPONENT LIST($Components_aT)
  //}

  // Avoid a "Hard link" with the component (when tokenizing a shared method)
  //{

If (Find in array($Components_aT;"MyReporterComp@")>0)

   EXECUTE METHOD("Comp_MyReporter_Server";*;$Every_N_Minutes_L;$Report_Format_L)

End if
  //}