新しい投稿

検索

記事
· 2024年9月17日 6m read

Como acessar o conteúdo do campo de um registro de uma global através do nome do campo

Como estou desenvolvendo uma aplicação para auditoria de arquivo fiscal digital, EFD ICMS IPI, optei por armazenar os dados diretamente em globais. Uma vez que os registros do arquivo EFD são formato txt e tem características semelhantes às linhas de registro de global.

Para poder analisar os itens de saída das Notas Fiscais Eletrônicas, fiz a importação também dos dados destes arquivos, e os armazenei em global. Segue exemplo:

1:  ^NFe = "Data|Chave|Arquivo Nome|<ide><cDV>|<ide><cMunFG>|<ide><cNF>|<ide><cUF>|<ide><dhEmi>|<ide><dhSaiEnt>|<ide><finNFe>|<ide><idDest>|<ide><indFinal>|<ide><indIntermed>|<ide><indPag>|<ide><indPres>|<ide><mod>|<ide><nNF>|<ide><natOp>|<ide><procEmi>|<ide><refNFe>|<ide><serie>|<ide><tpAmb>|<ide><tpEmis>|<ide><tpImp>|<ide><tpNF>|<ide><verProc>|<emit><CEP>|<emit><CNAE>|<emit><CNPJ>|<emit><CRT>|<emit><IE>|<emit><IEST>|<emit><IM>|<emit><UF>|<emit><cMun>|<emit><cPais>|<emit><fone>|<emit><nro>|<emit><xBairro>|<emit><xCpl>|<emit><xFant>|<emit><xLgr>|<emit><xMun>|<emit><xNome>|<emit><xPais>|<dest><CEP>|<dest><CNPJ>|<dest><CPF>|<dest><IE>|<dest><IM>|<dest><ISUF>|<dest><UF>|<dest><cMun>|<dest><cPais>|<dest><email>|<dest><fone>|<dest><indIEDest>|<dest><nro>|<dest><xBairro>|<dest><xCpl>|<dest><xLgr>|<dest><xMun>|<dest><xNome>|<dest><xPais>|<prod><![CDATA[SOQUETE LANTERNA DIANTEIRA SCANIA S4 / S5 124 98>|<prod><CEST>|<prod><CFOP>|<prod><EXTIPI>|<prod><NCM>|<prod><UFCons>|<prod><cBarra>|<prod><cBarraTrib>|<prod><cBenef>|<prod><cEAN>|<prod><cEANTrib>|<prod><cProd>|<prod><cProdANP>|<prod><cUFOrig>|<prod><dFab>|<prod><dVal>|<prod><descANP>|<prod><indEscala>|<prod><indImport>|<prod><indTot>|<prod><nFCI>|<prod><nItemPed>|<prod><nLote>|<prod><pBio>|<prod><pOrig>|<prod><qBCProd>|<prod><qCom>|<prod><qLote>|<prod><qTemp>|<prod><qTrib>|<prod><uCom>|<prod><uTrib>|<prod><vAliqProd>|<prod><vCIDE>|<prod><vDesc>|<prod><vFrete>|<prod><vOutro>|<prod><vPart>|<prod><vProd>|<prod><vUnCom>|<prod><vUnTrib>|<prod><xPed>|<prod><xProd>|<ICMS><CSOSN>|<ICMS><CST>|<ICMS><adRemICMSRet>|<ICMS><modBC>|<ICMS><modBCST>|<ICMS><motDesICMS>|<ICMS><orig>|<ICMS><pCredSN>|<ICMS><pDif>|<ICMS><pICMS>|<ICMS><pICMSEfet>|<ICMS><pICMSST>|<ICMS><pMVAST>|<ICMS><pRedBC>|<ICMS><pRedBCEfet>|<ICMS><pRedBCST>|<ICMS><pST>|<ICMS><qBCMonoRet>|<ICMS><vBC>|<ICMS><vBCEfet>|<ICMS><vBCST>|<ICMS><vBCSTDest>|<ICMS><vBCSTRet>|<ICMS><vCredICMSSN>|<ICMS><vICMS>|<ICMS><vICMSDeson>|<ICMS><vICMSDif>|<ICMS><vICMSEfet>|<ICMS><vICMSMonoRet>|<ICMS><vICMSOp>|<ICMS><vICMSST>|<ICMS><vICMSSTDest>|<ICMS><vICMSSTRet>|<ICMS><vICMSSubstituto>|<IPI><CNPJProd>|<IPI><CST>|<IPI><cEnq>|<IPI><cSelo>|<IPI><pIPI>|<IPI><qSelo>|<IPI><qUnid>|<IPI><vBC>|<IPI><vIPI>|<IPI><vIPIDevol>|<IPI><vUnid>|<PIS><CST>|<PIS><pPIS>|<PIS><qBCProd>|<PIS><vAliqProd>|<PIS><vBC>|<PIS><vPIS>|<COFINS><CST>|<COFINS><pCOFINS>|<COFINS><qBCProd>|<COFINS><vAliqProd>|<COFINS><vBC>|<COFINS><vCOFINS>|<infAdProd><infAdProd>|<total><dCompet>|<total><qBCMono>|<total><qBCMonoRet>|<total><qBCMonoReten>|<total><vBC>|<total><vBCST>|<total><vCOFINS>|<total><vDesc>|<total><vFCP>|<total><vFCPST>|<total><vFCPSTRet>|<total><vFCPUFDest>|<total><vFrete>|<total><vICMS>|<total><vICMSDeson>|<total><vICMSMono>|<total><vICMSMonoRet>|<total><vICMSMonoReten>|<total><vICMSUFDest>|<total><vICMSUFRemet>|<total><vII>|<total><vIPI>|<total><vIPIDevol>|<total><vISS>|<total><vNF>|<total><vOutro>|<total><vPIS>|<total><vProd>|<total><vRetCOFINS>|<total><vRetPIS>|<total><vST>|<total><vSeg>|<total><vServ>|<total><vTotTrib>"
2:  ^NFe("13240708979043000172550010000507261916206590",1) = "20240704|13240708979043000172550010000507261916206590|13240708979043000172550010000507261916206590-procNFe.xml|0'|1302603'|91620659'|13'|2024-07-04T15:19:00-04:00|2024-07-04T15:19:00-04:00|1'|2'|1'|||9'|55'|50726'|VENDA DE PRODUCAO DO|0'||1'|1'|1'|1'|1'|12.1.2310 |69093415'|3299002'|08979043000172'|3'|063005077'||11983401'|AM|1302603'|1058'|9240097407'|8656'|COLONIA TERRA NOVA||ARMOR DO BRASIL|AV TORQUATO TAPAJOS|MANAUS|ARMOR BRASIL IND. COM. FITAS P/IMP LTDA.|BRASIL|03116000'|57158941000175'||111783670118'|||SP|3550308'|1058'|notaeletronica@longwalk.com.br;;gerencia.oper@essencialcargo|1126054003'|1'|1430'|MOOCA||RUA DO ORATORIO|SAO PAULO|LONG WALK CONFECCOES LTDA|BRASIL|||6101||96121000||||AM23000001|7899462647990|7899462647990|TSL506IO||||||||1||01|||||100,0000|||100,0000|UND|UND|||||||6073,60|60,736000|60,736000|012267|ATX9 PAXAR SNAP 45MM X 400M - IO||00'||3|||4|||12,0000|||||||||6073,60||||||728,83|||||||||||52'|999|||||||||02'|1,3000|||5344,77|69,48|02'|6,0000|||5344,77|320,69||||||6073,60|0|320,69|0|0|0|0|0|0|728,83|0||||0|0|0|0|0||6073,60|0|69,48|6073,60|||0|0||983,92"

Com esta base, foi possível criar de forma dinâmica, os campos e o nome dos campos, independente da versão, quantidade de campos do XML, etc. Assim é possível exportar o conteúdo desta global para trabalhar com planilha Excel.

Porém, tive que desenvolver uma função em COS para detectar o conteúdo do campo conforme o nome do campo, em vez de ficar contando carneirinhos, pipelines. Sei que o processo poderia ser escrito de outra forma, mas a velocidade foi fantástica. Agora estou precisando de ajuda para desenvolver o FrontEnd. Se alguém se habilitar, me procure.

segue vídeo do processo:

https://youtu.be/wPjBaZCYul0

ディスカッション (0)1
続けるにはログインするか新規登録を行ってください
質問
· 2024年9月17日

Need help with XML to JSON format

Hello to my fellow Cache Gurus:

I ran into two issues with Cache to XML Export and Cache to JSON Export in regard to array sequences.   So before I waste time opening a WRC ticket, I figured I would poll the Development Community, since there is always so much wonderful feedback and suggestions via this Developer Community!   So much thanks in advance for everyone's input!   Go Team!

I have multiple classes that extend from %RegisteredObject and %XML.Adaptor.  These classes are populated with data from our application and the data of the overall class structure is exported as XML (and soon to be JSON) format.   And the XML export (and even JSON export) works very well, except for one small issue.

For a couple of the classes, there is a property that is defined as an array of another class.   Example:    Property Slides As array Of Q.Interface.Fragment.IMS.Slide;

When the objects in the array get exported to XML they show up with an attribute such as this:

          <slide slideSeq="1">    
                    // other property values show here
          </slide>
          <slide slideSeq="2">
                    // other property values show here
          </slide>

How can I get rid of that attribute?    Or is there a way to instead have the attribute export as an element?

When I try to output the data as JSON it is even worse.   The attribute name is tossed away as well as the object name (slide) and only the sequence number value is included.

Here is an example of the JSON:

                "1": {
                    // other property values show here
                },
                "2": {
                    // other property values show here
                },

I have no clue how to get the JSON to export properly with maintaining the object name (slide) like shown for the XML and suppressing the sequence value.

Thank you all!

6 Comments
ディスカッション (6)2
続けるにはログインするか新規登録を行ってください
質問
· 2024年9月17日

Stored procedure for insert into and select from tables

How to add the following to a stored procedure (Cache Studio)
1. Select from a few tables and insert result into a TABLEA.
2. Then select data from the TABLEA, apply some SQL logic, insert results into TABLEB.
3. SELECT * FROM TableA
    UNION ALL
    SELECT * FROM TableB

7 Comments
ディスカッション (7)1
続けるにはログインするか新規登録を行ってください
質問
· 2024年9月17日

Can I use a DTL for any HL7 message without specifying a DocType?

I have a theory that I could use an HL7 Data Transformer in a rule without specifying a specific DocType. I want to use the same DTL for a variety of different DocTypes. Here is my very simplistic DTL so far:

Class OrdRes.TestTransform Extends Ens.DataTransformDTL [ DependsOn = EnsLib.HL7.Message ]
{
    Parameter IGNOREMISSINGSOURCE = 1;
    Parameter REPORTERRORS = 1;
    Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;
    XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
    {
        <transform sourceClass='EnsLib.HL7.Message' targetClass='EnsLib.HL7.Message' create='new' language='objectscript' >
            <assign value='source' property='target' action='set' />
            <assign value='"test"' property='target.{MSH-4}' action='set' />
        </transform>
    }

}

For the more visual people:

 But when I test this with any HL7 message I get the error

ERROR <Ens>ErrGeneral: Cannot recognize path before DocType is set

Is there not a way to write a DTL for any HL7 message without specifying the DocType? And also, am I referencing the field correctly with target.{MSH-4}? I want to use the segment name and position instead of the field name since I'm not using a DocType.

5 Comments
ディスカッション (5)4
続けるにはログインするか新規登録を行ってください
質問
· 2024年9月17日

Cache-2018.1.9

Hi, Support Team

I´m working with Cache for many years, currently i have running version cache-2018.1.7.721.0-win_x64.exe

However we are facing some compatibility/requirements challenges, in that way i´m hereby request your support to provide next version/build of Cache 2018.1 (e.g cache-2018.1.9.xxx.x-win_x64.exe )

Nevertheless , I already downloaded IRIS for testing purpose if can also provide trial/limited licence for detail testing will be apreciated.

 

Thanks in advance for your attention.

Regards

Rajendra

8 Comments
ディスカッション (8)3
続けるにはログインするか新規登録を行ってください