Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replacement for USE/SELE table with IF...ELSE...ENDIF
Message
De
02/10/2007 11:34:15
 
 
À
02/10/2007 11:29:39
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01257862
Message ID:
01257944
Vues:
18
>>>>>>>>>>>I know there is some way of putting this on one line using IIF (I think), but I just can't recall it right now. Thanks!
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>IF NOT USED('Schedule')
>>>>>>>>>>>	USE Schedule IN 0
>>>>>>>>>>>ENDIF
>>>>>>>>>>SELECT Schedule
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>Ok, I thought there was a one-line way of doing it, but maybe not.
>>>>>>>>
>>>>>>>>Is this what you are looking for?
>>>>>>>>Use schedule in select('schedule')
>>>>>>>>NB! Will not work if you use other aliases than the name of the table.
>>>>>>>
>>>>>>>This differs from the original because it reopens the table is the either a new workarea or in the same workarea it is currently open. If don't care about this, then it is a slick method.
>>>>>>
>>>>>>This is all very well, and they all exhibit degrees of slickness, but I wonder what the point is.
>>>>>>
>>>>>>So you get a line of code that's so slick the beholder has to ponder it, maybe even try it out, before appreciating what it does, then is taken aback by how clever the author is.
>>>>>>
>>>>>>But that very fact is its weakness. And what has been gained other than the obviation of one or two lines of code, especially at the price of clarity?
>>>>>>
>>>>>>And I wonder why Jay was so keen in getting this.
>>>>>
>>>>>Because I had one line that did this and want it back again. I see your point, but in this case I can't imagine any code worth their pay could not see it fairly easily.
>>>>
>>>>Well you didn't spot the flaw I pointed out before, so there's the danger!
>>>>
>>>
>>>I said any coder worth their pay. Your mistake there... <g>
>>
>>
>>In Diff'rent Strokes style: Whachoo tarkin bou'!?
>>
>>Do you refute what I said in my wee experiment below?
>>
>>And I never said I couldn't see what it was (supposed to be) doing!
>
>Terry, I was referring to myself. It was a joke. Don't worry, your ego is still intact... <g>

CL, I'm not bothered re: my ego here (i take what you say with a cellar of salt anyway), but you did say to me "Your mistake there... <g>" so I'm just wondering what you referred to.

UPDATE: Oh, I've just realised: My mistake in thinking of YOU as worth your pay. :-)

Anyway, I'd like to know the verdict on whether
Use schedule in select('schedule')
works as wished or not.

IOW, in the end did you get your succinct code? cos I don't think I've seen one that works infallibly yet.

>
>>
>>>
>>>>Now I've just tried this one
>>>>
>>>>
Use schedule in select('schedule')
>>>>
>>>>with 2 tables open:
>>>>
>>>>If SCHEDULE is not open then it's opened and selected - fine.
>>>>However, if the other table is selected, then SCHEDULE does not get selected, the other table stays selected.
>>>>
>>>>
>>>>>
>>>>>
>>>>>>
>>>>>>My two-penn'orth.
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform