Migrating to Harbour

User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

Cristobal,
cnavarro wrote:This expression works?

Code: Select all

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

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Migrating to Harbour

Post 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 ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

Antonio,

Code: Select all

? oSheet:Cells( 1, 1 ):Value, VALTYPE( oSheet:Cells( 1, 1 ):Value )

Code: Select all

NIL U
EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Migrating to Harbour

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Migrating to Harbour

Post by Antonio Linares »

Enrico,

have you tried this ?

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

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post 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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Migrating to Harbour

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Migrating to Harbour

Post by Antonio Linares »

Enrico,

What is missing ?

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Migrating to Harbour

Post by Antonio Linares »

Enrico,

But this worked fine, right ?

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

Antonio Linares
www.fivetechsoft.com
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Migrating to Harbour

Post by Rick Lipkin »

Enrico

Can you try something like this ?

Code: Select all

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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post 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

oSheet:Cells( 1, 1 ):Value = ""
oSheet:Cells( 1, 1 ):Value = 0
oSheet:Cells( 1, 1 ):Value = .F.
EMG
Post Reply