Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Custom Transformation Rules

Posted on by 170

Hello. I would like to create new custom transformation rule. There is in system custom rule UNIXTIMESTAMP (CodeUnit 1225):

Documentation()

OnRun()

LOCAL [EventSubscriber] TransformUnixtimestampOnTransformation(TransformationCode : Code[20];InputText : Text;VAR OutputText : Text)
IF TransformationCode <> GetUnixTimestampCode THEN
  EXIT;
IF NOT TryConvert2BigInteger(InputText,OutputText) THEN
  OutputText := ''

LOCAL [EventSubscriber] InsertUnixtimestampOnCreateTransformationRules()
TransformationRule.InsertRec(
  GetUnixTimestampCode,UNIXTimeStampDescTxt,TransformationRule."Transformation Type"::Custom,0,0,'','');

LOCAL [TryFunction] TryConvert2BigInteger(InputText : Text;VAR OutputText : Text)
EVALUATE(TempBinteger,InputText);
OutputText := FORMAT(TypeHelper.EvaluateUnixTimestamp(TempBinteger));

GetUnixTimestampCode() : Code[20]
EXIT(UNIXTimeStampTxt);


Now, implementing above code, I would like to write own code to create ADDONEDAY Transformation Rule, which would add one day to specified date. I am new with NAV and developing it so I would like to start with add a simple record with new TransformationRule. I wrote this code (CodeUnit 99901):

Documentation()

OnRun()

LOCAL InsertAddOneDayToDateTransformationRules()
TransformationRule.InsertRec('ADDONEDAY', 'Add one day', TransformationRule."Transformation Type"::Custom, 0, 0, '', '');


I don't know how or where system should call above function to insert my Transformation Rule to the table. Is there any other place, where should I register own Transformation Rule?

Thanks for all answers! Good day for you all!

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Custom Transformation Rules

    Hi Mateusz,

    If you still have problem with this. To create custom transformation create new record in Transformation Rule table with "Transformation Type" = Custom.

    Then in new Codeunit you can create event subscriber function to table 1237 Transformation Rule with event type OnTrnasformation there you can change your date.

    Hope this helps.

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: Custom Transformation Rules

    They're used in Data Exchange management from NAV.

    Start checking these links:

    msdn.microsoft.com/.../dn495312(v=nav.90).aspx

    msdn.microsoft.com/.../mt299581(v=nav.90).aspx

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans