Hi, I'm Ask INFA!
What would you like to know?
ASK INFAPreview
Please to access Ask INFA.

Table of Contents

Search

  1. Preface
  2. Working with Transformations
  3. Address Validator Transformation
  4. Aggregator Transformation
  5. Association Transformation
  6. Bad Record Exception Transformation
  7. Case Converter Transformation
  8. Classifier Transformation
  9. Cleanse transformation
  10. Comparison Transformation
  11. Custom Transformation
  12. Custom Transformation Functions
  13. Consolidation Transformation
  14. Data Masking Transformation
  15. Data Masking Examples
  16. Decision Transformation
  17. Duplicate Record Exception Transformation
  18. Dynamic Lookup Cache
  19. Expression Transformation
  20. External Procedure Transformation
  21. Filter Transformation
  22. HTTP Transformation
  23. Identity Resolution Transformation
  24. Java Transformation
  25. Java Transformation API Reference
  26. Java Expressions
  27. Java Transformation Example
  28. Joiner Transformation
  29. Key Generator Transformation
  30. Labeler Transformation
  31. Lookup Transformation
  32. Lookup Caches
  33. Match Transformation
  34. Match Transformations in Field Analysis
  35. Match Transformations in Identity Analysis
  36. Merge Transformation
  37. Normalizer Transformation
  38. Parser Transformation
  39. Rank Transformation
  40. Router Transformation
  41. Sequence Generator Transformation
  42. Sorter Transformation
  43. Source Qualifier Transformation
  44. SQL Transformation
  45. Using the SQL Transformation in a Mapping
  46. Stored Procedure Transformation
  47. Standardizer Transformation
  48. Transaction Control Transformation
  49. Union Transformation
  50. Unstructured Data Transformation
  51. Update Strategy Transformation
  52. Weighted Average Transformation
  53. XML Transformations

Transformation Guide

Transformation Guide

Step 3. Fill Out the Method Stub with Implementation

Step 3. Fill Out the Method Stub with Implementation

The final step is coding the procedure.
  1. Open the
    <Procedure_Name>
    .cpp stub file generated for the procedure.
    In the BankSoft example, you open fv.cpp to code the TxINF_BankSoft::FV procedure.
  2. Enter the C++ code for the procedure.
    The following code implements the FV procedure:
    INF_RESULT TxINF_BankSoft::FV() {   // Input port values are mapped to the m_pInParamVector array in   // the InitParams method. Use m_pInParamVector[i].IsValid() to check   // if they are valid. Use m_pInParamVector[i].GetLong or GetDouble,   // etc. to get their value. Generate output data into m_pOutParamVector.   //  TODO: Fill in implementation of the FV method here.     ostrstream ss;     char* s;     INF_BOOLEAN bVal;     double v;     TINFParam* Rate = &m_pInParamVector[0];     TINFParam* nPeriods = &m_pInParamVector[1];     TINFParam* Payment = &m_pInParamVector[2];     TINFParam* PresentValue = &m_pInParamVector[3];     TINFParam* PaymentType = &m_pInParamVector[4];     TINFParam* FV = &m_pOutParamVector[0];     bVal =       INF_BOOLEAN(         Rate->IsValid() &&         nPeriods->IsValid() &&         Payment->IsValid() &&         PresentValue->IsValid() &&         PaymentType->IsValid()       );     if (bVal == INF_FALSE)     {       FV->SetIndicator(INF_SQL_DATA_NULL);       return INF_SUCCESS;     }     v = pow((1 + Rate->GetDouble()), (double)nPeriods->GetLong());     FV->SetDouble(       -(          (PresentValue->GetDouble() * v) +          (Payment->GetDouble() *            (1 + (Rate->GetDouble() * PaymentType->GetLong()))) *          ((v - 1) / Rate->GetDouble())       )     );     ss << "The calculated future value is: " << FV->GetDouble() <<ends;     s = ss.str();     (*m_pfnMessageCallback)(E_MSG_TYPE_LOG, 0, s);     (*m_pfnMessageCallback)(E_MSG_TYPE_ERR, 0, s);     delete [] s;     return INF_SUCCESS; }
    The Designer generates the function profile, including the arguments and return value. You need to enter the actual code within the function, as indicated in the comments. Since you referenced the POW function and defined an
    ostrstream
    variable, you must also include the preprocessor statements:
    On Windows:
    #include <math.h> #include <strstream> using namespace std;
    On UNIX, the include statements would be the following:
    #include <math.h> #include <strstream.h>
  3. Save the modified file.

0 COMMENTS

We’d like to hear from you!