Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Jun Tangunan
  Where is Jun Tangunan?
 Cabanatuan
 Philippines
 Jun Tangunan
 To: M. Akram Bhatti
  Where is M. Akram Bhatti?
 Riyadh
 Saudi Arabia
 M. Akram Bhatti
 Tags
Subject: RE: INLIST IN SELECT STATEMENT
Thread ID: 249029 Message ID: 249036 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Databases, Tables and SQL Server
Date: Sunday, December 27, 2009 11:07:19 AM         
   


> >
> >
> > Err... I did not see the version, LOL! Thanks!
> >
> > Then maybe he can use the Function GetStatus instead, but I believe CAST() is also not available there so he can use PADR() to ensure that it will hold the complete staff status:
> >
> >
Create Cursor junk (catcode c(10))
> > For lnloop = 1 To 7
> > 	Insert Into junk Values ("STF00"+Transform(lnloop))
> > Next
> > 
> > Select *, GetStatus() As STAFF_STATUS From junk
> > 
> > ******
> > Function GetStatus()
> > ******
> > Do Case
> > Case catcode ="STF001"
> > 	staffstat = PADR("SENIOR STAFF",30)
> > Case catcode="STF002"
> > 	staffstat = PADR("SENIOR STAFF",30)
> > Case catcode="STF003"
> > 	staffstat = PADR("SENIOR STAFF",30)
> > Case catcode="STF004"
> > 	staffstat = PADR("JUNIOR STAFF",30)
> > Case catcode="STF005"
> > 	staffstat = PADR("JUNIOR STAFF",30)
> > Case catcode="STF006"
> > 	staffstat = PADR("CLERICAL STAFF",30)
> > Case catcode="STF007"
> > 	staffstat = PADR("CLERICAL STAFF",30)
> > Endcase
> > Return staffstat
> > 

> > Jun Tangunan
> > http://weblogs.foxite.com/sandstorm36/default.aspx
> > http://www.coderisland.com/forum/viewforum.php?f=10
>
> To avoid truncating of text we can do:
>
>
> Create Cursor junk (catcode c(10))
> For lnloop = 1 To 7
>   Insert Into junk Values ("STF00"+Transform(lnloop))
> Next
> Select IIF(INLIST(CatCode,'STF001','STF002','STF003'),PADR('SENIOR STAFF',30), ;
> IIF(INLIST(CatCode, 'STF004','STF005'),PADR('JUNIOR STAFF',30),PADR('CLERICAL STAFF', 30))) ;
> AS Staff_Status From Junk
> 

>
> Regards,
> Akram


Yes, I have seen your answer and you added now a space on the "SENIOR STAFF ". Otherwise CLERICAL STAFF will be truncated. :-)

Jun Tangunan
http://weblogs.foxite.com/sandstorm36/default.aspx
http://www.coderisland.com/forum/viewforum.php?f=10

ENTIRE THREAD

INLIST IN SELECT STATEMENT Posted by DEREK DODOO @ 12/27/2009 10:12:30 AM
RE: INLIST IN SELECT STATEMENT Posted by Jun Tangunan @ 12/27/2009 10:34:45 AM
RE: INLIST IN SELECT STATEMENT Posted by M. Akram Bhatti @ 12/27/2009 10:47:17 AM
RE: INLIST IN SELECT STATEMENT Posted by Jun Tangunan @ 12/27/2009 10:56:32 AM
RE: INLIST IN SELECT STATEMENT Posted by M. Akram Bhatti @ 12/27/2009 11:02:41 AM
RE: INLIST IN SELECT STATEMENT Posted by Jun Tangunan @ 12/27/2009 11:07:19 AM
RE: INLIST IN SELECT STATEMENT Posted by M. Akram Bhatti @ 12/27/2009 10:53:26 AM
RE: INLIST IN SELECT STATEMENT Posted by Anders Altberg @ 12/27/2009 11:46:42 AM
RE: INLIST IN SELECT STATEMENT Posted by Jun Tangunan @ 12/27/2009 11:54:25 AM
RE: INLIST IN SELECT STATEMENT Posted by Anders Altberg @ 12/27/2009 3:24:11 PM
RE: INLIST IN SELECT STATEMENT Posted by kulwant singh @ 12/27/2009 3:39:46 PM
RE: INLIST IN SELECT STATEMENT Posted by tushar @ 12/27/2009 4:06:32 PM