Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Dale Dedoroy
  Where is Dale Dedoroy?
 Bacolod City, Negros Occidental
 Philippines
 Dale Dedoroy
 To: chris smith
  Where is chris smith?
 Yorkshire CH CH
 Barbados
 chris smith
 Tags
Subject: RE: Dale this is for you
Thread ID: 727 Message ID: 817 # Views: 1 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Thursday, June 14, 2001 10:38:31 PM         
   


> > > > >
> > > > > Thanks for your response. I'm using vfp5 an it does not have a trans() what does it do?
> > > > > smith
> > > >
> > > > Hello,
> > > >
> > > > trans() = transform()
> > > >
> > > > --
> > > > Eric den Doop
> > > > www.foxite.com - The Home Of The Visual FoxPro Experts
> > >
> > > Ha guys
> > > I modified the code just a little because I want to expand or contract the grid1 columns for all the character fields in the cursor. However I'm getting a syntax error at the line begining with lnMaxLength = IIf...............
> > > My changes are shown below.
> > > Can anyone help.
> > > **************************
> > > sele mycursor
> > > Local lnMaxLength
> > > lnMaxLength = 0
> > > for fnum = 1 to fcount()
> > > fc = field(fnum)
> > > if type('&fc') = "C"
> > > Scan
> > > lnMaxLength = IIf(Len(AllTrim(Transform(&fc))) > lnMaxLength,Len(AllTrim(Transform(&fc))),lnMaxLength)
> > > EndScan
> > > endif
> > > j = "column"+allt(str(fnum))
> > > thisform.grid1.&j..width = lnMaxLength + 10
> > > endfor
> > > **************************
> > >
> > > smith
> >
> > Hi Smith,
> > I tested your code (direct cut and paste) and did not find any syntax error to it except that you don't have to use a macro subtitution in Type('&fc'). You can write it like Type(fc) since macroing can slow down your app, except, of course, as the last effective recourse. Are you sure the error is in the IIf... line? Is it possible that you made some changes and compiled your app to an EXE and whenever you run newly modified prg or form, the EXE is executed instead that then triggers the error? If this is correct, erase the exe or re-compile your app.
> >
> > Hth,
> > Dale
>
> Hello Dale
> I'm still getting the syntax error by that line. Tell me are you using VFP5? Also the Transform() is going what exaclty in this code?
> smith

Sorry, I'm using v6. It's been a year since I moved up to 6 and I could not remember now if VFP5 requires additional parameter or not. I'm getting old, Chris. Anyway, I used the Transform() function to ensure that the code segment will work regardless of the var type. If you assure it being a char type as shown in your code, you can remove Transform. Leave Len() and AllTrim() as they are.

You can simulate your code in the Command Window. Like this:
b=123456
a='b'
?transform(&a)

If an error occurs in the last line, kindly consult the Transform() syntax in VFP5 help.

Hth,
Dale
---------
When you sow a thought, you reap an act
When you sow an act, you reap a habit
When you sow a habit, you reap a character
When you sow a character, you reap a destiny.
--------

ENTIRE THREAD

grid column width Posted by chris smith @ 6/12/2001 10:20:30 PM
RE: grid column width Posted by Dale Dedoroy @ 6/12/2001 11:20:36 PM
RE: What is trans() Posted by chris smith @ 6/13/2001 9:19:21 AM
RE: What is trans() Posted by Eric den Doop @ 6/13/2001 9:32:10 AM
RE: What is trans() Posted by chris smith @ 6/13/2001 10:18:53 AM
RE: What is trans() Posted by Dale Dedoroy @ 6/13/2001 8:30:08 PM
RE: Dale this is for you Posted by chris smith @ 6/14/2001 9:52:55 AM
RE: Dale this is for you Posted by Dale Dedoroy @ 6/14/2001 10:38:31 PM