Page 12 of 16

Re: Migrating to Harbour

PostPosted: Wed Dec 24, 2014 7:50 am
by Enrico Maria Giordano
Cristobal,

cnavarro wrote:This expression works?

Code: Select all  Expand view

oSheet:Cells( 1, 1 ):Value = CTOD( "  /  /  " )
 


No.

EMG

Re: Migrating to Harbour

PostPosted: Wed Dec 24, 2014 7:54 am
by Antonio Linares
Enrico,

Enrico Maria Giordano wrote:Antonio,

Antonio Linares wrote:When you use an empty date with xHarbour what value do you get in the Excel cell ?


NIL

EMG


NIL or NULL ?

Re: Migrating to Harbour

PostPosted: Wed Dec 24, 2014 9:48 am
by Enrico Maria Giordano
Antonio,

Code: Select all  Expand view
? oSheet:Cells( 1, 1 ):Value, VALTYPE( oSheet:Cells( 1, 1 ):Value )


Code: Select all  Expand view
NIL U


EMG

Re: Migrating to Harbour

PostPosted: Wed Dec 24, 2014 5:16 pm
by Antonio Linares
Enrico,

I meant what do you see in Excel. What is shown is Excel ?

Not the value that you get from Harbour.

Re: Migrating to Harbour

PostPosted: Wed Dec 24, 2014 5:31 pm
by Enrico Maria Giordano
Antonio,

Antonio Linares wrote:I meant what do you see in Excel. What is shown is Excel ?

Not the value that you get from Harbour.


Sorry. I see an empty cell. So we only need an automatic convertion from CTOD( "" ) to NIL.

EMG

Re: Migrating to Harbour

PostPosted: Wed Dec 24, 2014 5:33 pm
by Antonio Linares
Enrico,

have you tried this ?

oSheet:Cells( 1, 1 ):Value = nil

Re: Migrating to Harbour

PostPosted: Wed Dec 24, 2014 6:09 pm
by Enrico Maria Giordano
Antonio,

Antonio Linares wrote:have you tried this ?

oSheet:Cells( 1, 1 ):Value = nil


Yes, I already reported the result. It works.

EMG

Re: Migrating to Harbour

PostPosted: Wed Dec 24, 2014 6:17 pm
by nageswaragunupudi
As of now there is no way except review all our code and modify wherever dates are assigned.

oSheet:Cells(r,c):NumberFormat := "dd-mm-yyyy" // or similar
oSheet:Cells(r,c):Value := If( Year(d) < 1900, nil, d )

I prefer
oSheet:Cells(r,c):Value := If( Year(d) < 1900, AdoNull(), d )
This works with ADO also.

Re: Migrating to Harbour

PostPosted: Wed Dec 24, 2014 6:29 pm
by Enrico Maria Giordano
Nages,

absolutely impractical... :-(

EMG

Re: Migrating to Harbour

PostPosted: Wed Jan 07, 2015 1:42 pm
by Enrico Maria Giordano
Dear friends,

any news? I'm stuck with my Harbour migration... :-(

EMG

Re: Migrating to Harbour

PostPosted: Wed Jan 07, 2015 9:20 pm
by Antonio Linares
Enrico,

What is missing ?

I mean, something that really stops you to migrate to Harbour :-)

Re: Migrating to Harbour

PostPosted: Wed Jan 07, 2015 9:24 pm
by Enrico Maria Giordano
Antonio,

this one:

Code: Select all  Expand view
oSheet:Cells( 1, 1 ):Value = CTOD( "" )


EMG

Re: Migrating to Harbour

PostPosted: Wed Jan 07, 2015 9:33 pm
by Antonio Linares
Enrico,

But this worked fine, right ?

oSheet:Cells( 1, 1 ):Value = nil

Re: Migrating to Harbour

PostPosted: Wed Jan 07, 2015 10:17 pm
by Rick Lipkin
Enrico

Can you try something like this ?

Code: Select all  Expand view

oSheet:Range( "A:A" ):Set( "NumberFormat", '00/00/00' ) // field mask

// sets headers
oSheet:Cells( 1, 1 ):value  := "Date"
...
...
...

Do while ...
     
     oSheet:Cells( nRow, 1 ):Value  := ctod("")
     ...
     ....
     nRow++
     skip

Enddo  
 


In my code NumberFormat works on Char as well as numeric .. perhaps in it would force the above picture clause on column 1 to 00/00/00 ?

Rick Lipkin

Re: Migrating to Harbour

PostPosted: Wed Jan 07, 2015 10:20 pm
by Enrico Maria Giordano
Antonio,

Antonio Linares wrote:But this worked fine, right ?

oSheet:Cells( 1, 1 ):Value = nil


Yes. But I have far too many places when dates can be empty.

Anyway, does it make sense that we can assign all empty types except date? These all work:

Code: Select all  Expand view
oSheet:Cells( 1, 1 ):Value = ""
oSheet:Cells( 1, 1 ):Value = 0
oSheet:Cells( 1, 1 ):Value = .F.


EMG