Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Samir H.
  Where is Samir H.?
 Yogyakarta
 Indonesia
 Samir H.
 To: onytoo
  Where is onytoo?
 Padang
 Indonesia
 onytoo
 Tags
Subject: RE: rename table if
Thread ID: 289214 Message ID: 289293 # Views: 26 # Ratings: 0
Version: Visual FoxPro 9 Category: Forms
Date: Thursday, December 30, 2010 11:47:25 AM         
   


> >
> >
> > Hi Jun
> > Why do you think transform() is cleaner? I always use ltrim(str()) for numerics, it is faster...
> >
file_to_copy= "month"+ltrim(str(month(date())))+ltrim(str(year(date())))+".dbf"
> > 
> > file_to_copy= "month"+TRANSFORM(MONTH(DATE()))+TRANSFORM(YEAR(DATE()))+".dbf"

> >
> >
> > Regards
> > Samir
>
> Hi, Sammy..
>
> TRANSFORM is more simple and you not need to worried about any data type to convert,
> eExpression parameter can use directly with numeric, string, logical, date, etc.
>
> IMHO, if TRANSFORM was used without cFormatCodes parameter, it same as ALLTRIM(STR().
> And yes XTRIM(STR()) more faster than TRANSFORM().
>
>
> Regards,
> Onytoo

I agree that transform() is very convenient when the data type is unknown. OTOH, I think we should transform data using the appropriate functions if the data type is known. This helps avoid & debug errors:
cVal='5'
?TRANSFORM(cVal)	&& no error!
?LTRIM(STR(cVal))	&& error


Regards
Samir

ENTIRE THREAD

rename table if Posted by mohammed qasem @ 12/29/2010 3:15:43 PM
RE: rename table if Posted by Ony Too @ 12/29/2010 3:35:29 PM
RE: rename table if Posted by Samir H. @ 12/29/2010 3:35:53 PM
RE: rename table if Posted by mohammed qasem @ 12/29/2010 3:47:13 PM
RE: rename table if Posted by Jun Tangunan @ 12/30/2010 5:22:29 AM
RE: rename table if Posted by Samir H. @ 12/30/2010 5:31:06 AM
RE: rename table if Posted by Jun Tangunan @ 12/30/2010 5:46:44 AM
RE: rename table if Posted by Ony Too @ 12/30/2010 10:56:48 AM
RE: rename table if Posted by Samir H. @ 12/30/2010 11:47:25 AM