Skip to Main Content
InterSystems Ideas
We love hearing from our users. Tell us what you want to see next and upvote ideas from the community.
* Bugs and troubleshooting should as usual go through InterSystems support.
Status Needs review
Created by Stefan Cronje
Created on Feb 13, 2023

Automatic XML Formatting of XData in DTL, BPL and Rulesets

The basic idea is that when a DTL, BPL or ruleset is edited on the SMP, that is formats the XML in the XData block.

With large DTL, Rulesets and BPL, it is sometimes easier to open the class, collapse some sections of the XML and check the flow. Proper formatting will assist in this.

  • ADMIN RESPONSE
    Jun 3, 2024

    Thank you for submitting the idea. The status has been changed to "Needs review".

    Stay tuned!

  • Admin
    Vadim Aniskin
    Reply
    |
    Jun 3, 2024

    Stefan, thanks for the clarification. I returned the status as "Needs review". I hope the product managers will provide feedback on your idea soon.

  • Stefan Cronje
    Reply
    |
    Jun 3, 2024

    When a DTL, Ruleset or BPL is saved, the XML lines are all at the same level.
    We have DTLs that are 2000 lines long and it is easier to edit as XML than using the DTL editor. If the XML was formatted, it will be easier. We reformet these, but if the DTL editor is used at any point, it changes all the formatting again. The same applies to rulesets and BPL.

    Example of requirement:
    Currently the XML looks like this after saving on the DTL editor.

    XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
    
    {
    <transform sourceClass='CMSLibrary.ExtSP.Hyphen.File.SOCS.RETURN.CRM.Batch.Batch' targetClass='CMSLibrary.Messages.EnsReq.Transformation.Generic.GenericStagedChannelRspFile' create='new' language='objectscript'>
    <assign value='source.Trailer.NoOfTransactions' property='target.Trailer.RecordCount' action='set'/>
    <assign value='source.Trailer.Value/100' property='target.Trailer.CheckTotal' action='set'/>
    <foreach property='source.TransactionRecord()' key='k1'>
    <if condition='..In(source.TransactionRecord.(k1).TRTP,"Q2HDR,Q2TRL")'>
    <false>
    <assign value='$Increment(RecIndex)' property='RecIndex' action='set'/>
    <assign value='1' property='target.DetailRecords.(RecIndex).CollectionMethod' action='set'/>
    <assign value='source.TransactionRecord.(k1).USRF2' property='target.DetailRecords.(RecIndex).ReferenceNumber' action='set'/>
    <assign value='source.TransactionRecord.(k1).%ClassName(1)' property='target.DetailRecords.(RecIndex).DetailClassName' action='set'/>
    <assign value='source.TransactionRecord.(k1).%Id()' property='target.DetailRecords.(RecIndex).DetailId' action='set'/>
    <assign value='source.TransactionRecord.(k1).ERRC' property='target.DetailRecords.(RecIndex).ChannelReplyCode' action='set'/>
    <assign value='$select(source.TransactionRecord.(k1).CNPAYD="":"",1:$zdh(source.TransactionRecord.(k1).CNPAYD,3))' property='target.DetailRecords.(RecIndex).EffectiveDate' action='set'/>
    <assign value='$select(source.TransactionRecord.(k1).DDTE="":"",1:$zdh(source.TransactionRecord.(k1).DDTE,3))' property='target.DetailRecords.(RecIndex).ExpectedDate' action='set'/>
    <assign value='"000085000"' property='target.DetailRecords.(RecIndex).ChannelConfirmedService' action='set'/>
    <if condition='..In(source.TransactionRecord.(k1).DOCT,"S1,S3,,S5,S7")'>
    <true>
    <assign value='source.TransactionRecord.(k1).AMTR/100' property='target.DetailRecords.(RecIndex).Amount' action='set'/>
    </true>
    <false>
    <if condition='source.TransactionRecord.(k1).DOCT = "SN"'>
    <true>
    <assign value='0000000000' property='target.DetailRecords.(RecIndex).ReferenceNumber' action='set'/>
    </true>
    <false>
    <if condition='source.TransactionRecord.(k1).DOCT = "S8"'>
    <true>
    <assign value='0000000000' property='target.DetailRecords.(RecIndex).ReferenceNumber' action='set'/>
    <assign value='-target.DetailRecords.(RecIndex).Amount' property='target.DetailRecords.(RecIndex).Amount' action='set'/>
    </true>
    <false>
    <assign value='0000000000' property='target.DetailRecords.(RecIndex).ReferenceNumber' action='set'/>
    <assign value='-target.DetailRecords.(RecIndex).Amount' property='target.DetailRecords.(RecIndex).Amount' action='set'/>
    </false>
    </if>
    </false>
    </if>
    </false>
    </if>
    </false>
    </if>
    </foreach>
    </transform>
    }

    What I would like it to look like:

    XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
    
    {
    <transform sourceClass='CMSLibrary.ExtSP.Hyphen.File.SOCS.RETURN.CRM.Batch.Batch' targetClass='CMSLibrary.Messages.EnsReq.Transformation.Generic.GenericStagedChannelRspFile' create='new' language='objectscript'>
    <assign value='source.Trailer.NoOfTransactions' property='target.Trailer.RecordCount' action='set'/>
    <assign value='source.Trailer.Value/100' property='target.Trailer.CheckTotal' action='set'/>
    <foreach property='source.TransactionRecord()' key='k1'>
    <if condition='..In(source.TransactionRecord.(k1).TRTP,"Q2HDR,Q2TRL")'>
    <false>
    <assign value='$Increment(RecIndex)' property='RecIndex' action='set'/>
    <assign value='1' property='target.DetailRecords.(RecIndex).CollectionMethod' action='set'/>
    <assign value='source.TransactionRecord.(k1).USRF2' property='target.DetailRecords.(RecIndex).ReferenceNumber' action='set'/>
    <assign value='source.TransactionRecord.(k1).%ClassName(1)' property='target.DetailRecords.(RecIndex).DetailClassName' action='set'/>
    <assign value='source.TransactionRecord.(k1).%Id()' property='target.DetailRecords.(RecIndex).DetailId' action='set'/>
    <assign value='source.TransactionRecord.(k1).ERRC' property='target.DetailRecords.(RecIndex).ChannelReplyCode' action='set'/>
    <assign value='$select(source.TransactionRecord.(k1).CNPAYD="":"",1:$zdh(source.TransactionRecord.(k1).CNPAYD,3))' property='target.DetailRecords.(RecIndex).EffectiveDate' action='set'/>
    <assign value='$select(source.TransactionRecord.(k1).DDTE="":"",1:$zdh(source.TransactionRecord.(k1).DDTE,3))' property='target.DetailRecords.(RecIndex).ExpectedDate' action='set'/>
    <assign value='"000085000"' property='target.DetailRecords.(RecIndex).ChannelConfirmedService' action='set'/>
    <if condition='..In(source.TransactionRecord.(k1).DOCT,"S1,S3,,S5,S7")'>
    <true>
    <assign value='source.TransactionRecord.(k1).AMTR/100' property='target.DetailRecords.(RecIndex).Amount' action='set'/>
    </true>
    <false>
    <if condition='source.TransactionRecord.(k1).DOCT = "SN"'>
    <true>
    <assign value='0000000000' property='target.DetailRecords.(RecIndex).ReferenceNumber' action='set'/>
    </true>
    <false>
    <if condition='source.TransactionRecord.(k1).DOCT = "S8"'>
    <true>
    <assign value='0000000000' property='target.DetailRecords.(RecIndex).ReferenceNumber' action='set'/>
    <assign value='-target.DetailRecords.(RecIndex).Amount' property='target.DetailRecords.(RecIndex).Amount' action='set'/>
    </true>
    <false>
    <assign value='0000000000' property='target.DetailRecords.(RecIndex).ReferenceNumber' action='set'/>
    <assign value='-target.DetailRecords.(RecIndex).Amount' property='target.DetailRecords.(RecIndex).Amount' action='set'/>
    </false>
    </if>
    </false>
    </if>
    </false>
    </if>
    </false>
    </if>
    </foreach>
    </transform>
    }
  • Admin
    Vadim Aniskin
    Reply
    |
    May 24, 2024

    Stefan, thank you so much for your idea. Could you please answer the questions from Product Manager to clarify this idea:

    • Visual Studio supports XML formatting, is that still insufficient? If so, how?

    • The interoperability editors are currently being reworked and the goal is to remove the need to drop back into the code for certain activities (like moving actions around)