-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About Reading-AppResponse #2
Comments
Hola Hernán, ciertamente hablo español! ( directo desde Venezuela ),
Sólo que publico mucho en inglés porque es donde mas participo.
Prueba así: ( no puedo entrar a explicarte en detalle por razones de tiempo )
Saludos.
** Leyendo-AppResponse.prg
**
m.cXML = '.\FECP-12523-3-ApplicationResponse.xml'
m.cXML = '.\FEL-123-ApplicationResponse.xml'
Set Path To "D:\vfpX\nfXml\nfXml"
** nfXMLread ( VFP XML PARSER )
** Marco Plaza, 2013-2018 @nfTools
m.oXML = nfXMLRead(M.cXML)
If Isnull(M.oXML)
Messagebox('Error leyendo el XML','nfXML-Read')
Return
Endif
Create Cursor DATOS ( Id c(10), ResponseCode c(10), Description c(254) )
Create Cursor lineResponse ( LineId c(5), ResponseCode c(10), Description c(254) )
With oXML.applicationResponse.cac_DocumentResponse
Insert Into DATOS ;
( Id, ResponseCode, Description ) ;
values ;
( .cac_documentReference.cbc_Id,.cac_Response.cbc_ResponseCode, .cac_Response.cbc_Description )
For Each oLine In .cac_LineResponse
Insert Into lineResponse ;
( ;
LineId,;
ResponseCode,;
Description ) ;
values ;
( ;
oLine.cac_linereference.cbc_LineId,;
oLine.cac_Response.cbc_ResponseCode,;
oLine.cac_Response.cbc_Description )
Endfor
Endwith
Select DATOS
Acti Scre
Brow Nomo
Select lineResponse
Browse Normal
Enviado desde Correo para Windows
De: jhernancanom
Enviado: domingo, 5 de septiembre de 2021 4:29 a. m.
Para: VFPX/nfXML
CC: Subscribed
Asunto: [VFPX/nfXML] About Reading-AppResponse (#2)
Hi, Marco.
If Spanish is your native language, please.
I am using your nfXML to read an XML and convert it to a VFP-object.
I am triyng to get info from the XML I attach (Colombian Electronic Invoicing), but I am having troubles.
I have written an script --attached too-- for showing you. And I put several MessageBoxes for we to see.
This script was based on info that I found in
https://www.tek-tips.com/viewthread.cfm?qid=1753479
We run the sample. If we suspend and go to the Debugger, we can see the image #1.
I am interested (in this question) in cac_DocumentResponse, and its only three sub-elements inside it:
|------------------------|----------------|-----------------|
| | Debugger shows | My script shows |
|------------------------|----------------|-----------------|
|cac_DocumentResponse | | |
| cac_DocumentReference | object | object |
| cac_Response | array | object |
| cac_LineResponse | object | object |
|------------------------|----------------|-----------------|
I understand that I can get info from cac_DocumentReference and cac_Response directly as I show in image-04,....
But... I do not understand why the FOR EACH fails if the two FORs with AMEMBERS and GETPEM run both fine.
And also.... How can/should I walk thru the three sub-elements I mention before and thru the several cac:LineResponse's?
I show you two ways, but both fail. First inside the first FOR, and second commented inside #IF .F. and #ENDIF.
I use the method commented inside #IF .F. and #ENDIF, because the cac:LineResponse's can be several, non-defined how much.
I made some adjustments to nfXmlRead.prg as you can see marked as HCM, because nfXmlRead failed me in my scenarios.
Also I prefer LOCAL variables; nfXML.h inside nfXmlRead.prg is not mandatory; I used prefixes in mem vbles and parameters in order to prevent conflicts with vbles in our applications.
Please check them and try to adjust to a new version... where possible.
Thanks for sharing.
HERNAN CANO
Reading-AppResponse.zip
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Sí, Marco. Gracias.
Esa fue la misma conclusión a la que llegué para solucionar.
Pero mi pregunta es: ¿por qué no funciona el sgte FOR EACH...?
for each M.oData in M.oXML.ApplicationResponse.cac_DocumentResponse
VFP dice que la propiedad cac_DocumentResponse no se encuentra.
El lun, 6 de sep. de 2021 a la(s) 00:42, Marco Plaza escribió:
…
Hola Hernán, ciertamente hablo español! ( directo desde Venezuela ),
Sólo que publico mucho en inglés porque es donde mas participo.
Prueba así: ( no puedo entrar a explicarte en detalle por razones de
tiempo )
Saludos.
|
Hernán
oXML.applicationResponse.cac_DocumentResponse
no es un array ( es un objeto )
for each sólo recorre elementos de arrays
Enviado desde Correo para Windows
De: jhernancanom
Enviado: lunes, 6 de septiembre de 2021 10:52 a. m.
Para: VFPX/nfXML
CC: Marco Plaza; Comment
Asunto: Re: [VFPX/nfXML] About Reading-AppResponse (#2)
Sí, Marco. Gracias.
Esa fue la misma conclusión a la que llegué para solucionar.
Pero mi pregunta es: ¿por qué no funciona el sgte FOR EACH...?
for each M.oData in M.oXML.ApplicationResponse.cac_DocumentResponse
VFP dice que la propiedad cac_DocumentResponse no se encuentra.
El lun, 6 de sep. de 2021 a la(s) 00:42, Marco Plaza escribió:
Hola Hernán, ciertamente hablo español! ( directo desde Venezuela ),
Sólo que publico mucho en inglés porque es donde mas participo.
Prueba así: ( no puedo entrar a explicarte en detalle por razones de
tiempo )
Saludos.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Huy, ya me confundí.
En la ayuda dice que se usa cuando es un arreglo o una colección.
Cuando lo he usado, no me había dado cuenta de éso. Pensaba que se podía
usar cuando un "objeto" tiene varios elementos (objetos, o propiedades, o
cualq otra cosa), como en este caso (que justamente son objetos), pues yo
veo que el objeto
oXML.ApplicationResponse.*cac_DocumentResponse*
contiene otros tres objetos llamados:
oXML.ApplicationResponse.cac_DocumentResponse.*cac_DocumentReference*
oXML.ApplicationResponse.cac_DocumentResponse.*cac_Response*
oXML.ApplicationResponse.cac_DocumentResponse.*cac_LineResponse*
Pero... bueno... también sé que no debo pelear con el core de un
lenguaje.....
Así que tendré que avanzar en la forma en que me lo permita.
Gracias por compartir.
El mar, 7 de sep. de 2021 a la(s) 09:51, Marco Plaza escribió:
… Hernán
oXML.applicationResponse.cac_DocumentResponse
no es un array ( es un objeto )
for each sólo recorre elementos de arrays
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, Marco.
If Spanish is your native language, please.
I am using your nfXML to read an XML and convert it to a VFP-object.
I am triyng to get info from the XML I attach (Colombian Electronic Invoicing), but I am having troubles.
I have written an script --attached too-- for showing you. And I put several MessageBoxes for we to see.
This script was based on info that I found in
https://www.tek-tips.com/viewthread.cfm?qid=1753479
We run the sample. If we suspend and go to the Debugger, we can see the image #1.
I am interested (in this question) in cac_DocumentResponse, and its only three sub-elements inside it:
I understand that I can get info from cac_DocumentReference and cac_Response directly as I show in image-04,....
But... I do not understand why the FOR EACH fails if the two FORs with AMEMBERS and GETPEM run both fine.
And also.... How can/should I walk thru the three sub-elements I mention before and thru the several cac:LineResponse's?
I show you two ways, but both fail. First inside the first FOR, and second commented inside #IF .F. and #ENDIF.
I use the method commented inside #IF .F. and #ENDIF, because the cac:LineResponse's can be several, non-defined how much.
I made some adjustments to nfXmlRead.prg as you can see marked as HCM, because nfXmlRead failed me in my scenarios.
Also I prefer LOCAL variables; nfXML.h inside nfXmlRead.prg is not mandatory; I used prefixes in mem vbles and parameters in order to prevent conflicts with vbles in our applications.
Please check them and try to adjust to a new version... where possible.
Thanks for sharing.
HERNAN CANO
Reading-AppResponse.zip
The text was updated successfully, but these errors were encountered: