Page 2 of 4
Re: FROM XML TO DBF
Posted: Mon Jan 16, 2023 6:59 am
by tomtagaris
Τhank you all for your help
Thanasis
Re: FROM XML TO DBF
Posted: Mon Jan 16, 2023 8:29 am
by serge_girard
I really prefer files in DBF or simple flatfiles.... XML and JSON are not for humans?
Serge
Re: FROM XML TO DBF
Posted: Mon Jan 23, 2023 8:55 am
by tomtagaris
I finally followed the solution of EDK who I thank from the bottom of my heart for the help he has offered me. And I would like ask for a problem I am encountering in the transfer to dbf of the date from an hml file because it is in yyyy-mm-dd format I convert it with SUBSTR() in ctod( dd/mm/yyyy) format but some dates are not transferred βut is empty (//) like this
can someone help me
thanks
Re: FROM XML TO DBF
Posted: Mon Jan 23, 2023 10:00 am
by dragancesu
Re: FROM XML TO DBF
Posted: Mon Jan 23, 2023 10:47 am
by edk
tomtagaris wrote: ↑Mon Jan 23, 2023 8:55 am
And I would like ask for a problem I am encountering in the transfer to dbf of the date from an hml file because it is in yyyy-mm-dd format I convert it with SUBSTR() in ctod( dd/mm/yyyy) format but some dates are not transferred βut is empty (//) like this
can someone help me
thanks
The easiest way is to use the function hb_CtoD(<cDate> [, <cDateFormat>]) -> dDate, for example:
Code: Select all
REPLACE issueDate WITH hb_CtoD( cXmlIssueDate, "YYYY-MM-DD" )
@dragancesu
The function will convert a string to a date variable. So it doesn't matter what
date display format you have set.
Re: FROM XML TO DBF
Posted: Mon Jan 23, 2023 12:46 pm
by tomtagaris
Thanks very much
Re: FROM XML TO DBF
Posted: Mon Jan 30, 2023 10:07 am
by tomtagaris
one more question
how to export if there are many lines
<invoiceDetails>
<lineNumber>1</lineNumber>
<quantity>15</quantity>
<measurementUnit>1</measurementUnit>
<netValue>48.45</netValue>
<vatCategory>1</vatCategory>
<vatAmount>11.63</vatAmount>
</invoiceDetails>
<invoiceDetails>
<lineNumber>2</lineNumber>
<quantity>2</quantity>
<measurementUnit>1</measurementUnit>
<netValue>25.74</netValue>
<vatCategory>1</vatCategory>
<vatAmount>6.18</vatAmount>
</invoiceDetails>
<invoiceDetails>
<lineNumber>3</lineNumber>
<quantity>30</quantity>
<measurementUnit>1</measurementUnit>
<netValue>25.5</netValue>
<vatCategory>1</vatCategory>
<vatAmount>6.12</vatAmount>
</invoiceDetails>
<invoiceDetails>
<lineNumber>4</lineNumber>
<quantity>2</quantity>
<measurementUnit>1</measurementUnit>
<netValue>30</netValue>
<vatCategory>1</vatCategory>
<vatAmount>7.2</vatAmount>
</invoiceDetails>
<invoiceDetails>
<lineNumber>5</lineNumber>
<quantity>3</quantity>
<measurementUnit>1</measurementUnit>
<netValue>19.5</netValue>
<vatCategory>1</vatCategory>
<vatAmount>4.68</vatAmount>
</invoiceDetails>
<invoiceDetails>
<lineNumber>6</lineNumber>
<quantity>10</quantity>
<measurementUnit>1</measurementUnit>
<netValue>22</netValue>
<vatCategory>1</vatCategory>
<vatAmount>5.28</vatAmount>
Re: FROM XML TO DBF
Posted: Mon Jan 30, 2023 12:22 pm
by edk
Just:
Code: Select all
CASE cKey == "uid" .AND. cPath == "RequestedDoc/invoicesDoc/invoice"
SELECT invoice
APPEND BLANK
REPLACE invoice->iud WITH xValue
...
CASE cKey == "lineNumber" .AND. cPath == "RequestedDoc/invoicesDoc/invoice/invoiceDetails"
SELECT invoiceDetails
APPEND BLANK
REPLACE invoiceDetails->uid WITH invoice->iud
REPLACE invoiceDetails->LineNumber WITH xValue
Re: FROM XML TO DBF
Posted: Mon Jan 30, 2023 12:27 pm
by tomtagaris
YES BUT WRITE ONLY ONE LINE BUT THE REST
Re: FROM XML TO DBF
Posted: Mon Jan 30, 2023 12:37 pm
by tomtagaris
ΟΚ I WILL TRY IT
ΤΗΑΝΚΣ