Version 13 (modified by 15 years ago) ( diff ) | ,
---|
FDO RFC 22 - Enhance expression engine CONCAT function
This page contains an change request (RFC) for the FDO Open Source project. More FDO RFCs can be found on the RFCs page.
Status
RFC Template Version | (1.0) |
Submission Date | June 25, 2008 |
Last Modified | Dan Stoica Timestamp |
Author | Dan Stoica, Orest Halustchak |
RFC Status | adopted |
Implementation Status | pending |
Proposed Milestone | 3.5.0.0 |
Assigned PSC guide(s) | Greg Boone |
Voting History | |
+1 | Orest, Traian, Greg, Jackie |
+0 | |
-0 | |
-1 |
Overview
This RFC is for adding an additional syntax to the CONCAT function of the expression engine.
Motivation
The existing CONCAT function syntax is difficult to work with when multiple concatenations need to be done. It requires the CONCAT functions be nested whenever a new item needs to be concatenated.
Proposed Solution
The proposed solution is to add support for an additional syntax to the CONCAT function.
Old syntax:
CONCAT ('Parcel ID: ', CONCAT ( PID , CONCAT ('\nOwner Name: ', CONCAT ( OWNER_NAME , CONCAT ('\nAddress: ', SITE_ADDR )))))
New syntax:
CONCAT ('Parcel ID: ', PID , '\nOwner Name: ', OWNER_NAME, '\nAddress: ', SITE_ADDR )
The new syntax will consist of a comma delimited list of concatenation items.
In terms of API changes, the following addition to FdoFunctionDefinition class is proposed:
class FdoFunctionDefinition : public FdoIDisposable { ... public: /// \brief /// Indicates that this object allows its list of arguments to be variable so the /// last argument may be repeated. /// /// \return /// Returns false /// FDO_API virtual bool FdoFunctionDefinition::SupportsVariableArgumentsList() { return false; }
FdoFunctionConcat will override SupportsVariableArgumentsList() to return true instead. It will relax the check for allowed number of literal values passed in for evaluation.
/// Indicates that this object allows its list of arguments to be variable so the /// last argument may be repeated. /// virtual bool SupportsVariableArgumentsList() { return true; }
Implications
The existing CONCAT function syntax will continue to be supported in addition to the new syntax.
The client UI has the means to display "..." by checking the new method.
Test Plan
Test that the existing and new CONCAT function syntax work. Update the Expression Engine unit test to exercise CONCAT with extra arguments.
Funding/Resources
Autodesk to provide resurces / funding.
CORRECTION
An adjustment to the proposed design needs to be made: FdoConcatFunction class doesn't extend FdoFunctionDefinition class. As a consequence the new method FdoFunctionDefinition::SupportsVariableArgumentsList() is not virtual and the FdoFunctionDefinition constructors need to take an extra parameter instead, as:
class FdoFunctionDefinition : public FdoIDisposable { ... public: /// \brief /// Indicates that this object allows its list of arguments to be variable so the /// last argument may be repeated. /// /// \return /// Returns true if the function allows a variable list of arguments and false otherwise. /// FDO_API bool FdoFunctionDefinition::SupportsVariableArgumentsList(); /// The existing 3 Create methods will take a new 'supportsVariableArgumentsList = false' input parameter as the last input parameter. /// Input a flag indicating whether or not this function supports a variable list of arguments /// \param supportsVariableArgumentsList FDO_API static FdoFunctionDefinition *Create (..., bool supportsVariableArgumentsList = false);