rango dates

Re: rango dates

Postby Silvio » Wed Jun 17, 2009 3:40 pm

JAMES,

set filter to alltrim((oDPre)->tipoattrez)) == cTipoAttrez .AND. (oDPre)->CAMERA == n ;
.AND. ;
(;
( dDataIniziale >= (oDPre)->DAL .AND. dDataIniziale <= (oDPre)->AL ) .OR. ;
( dDataFinale >= (oDPre)->DAL .AND. dDataFinale <= (oDPre)->AL ) .OR. ;
( dDataIniziale < (oDPre)->DAL .AND. dDataFinale > (oDPre)->AL ) ;
)

WHY THE COMPILATOR LET ME SAY
source\RIV220.prg(275) Error E0030 Syntax error: "syntax error at 'FILTER'" ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: rango dates

Postby James Bott » Wed Jun 17, 2009 3:50 pm

Silvio,

I don't see the error, but use the simpler filter like this:

set filter to alltrim((oDPre)->tipoattrez)) == cTipoAttrez .AND. (oDPre)->CAMERA == n ;
.AND. ( dIniziale <= (oDPre)->AL .AND. dFinale >= (oDPre)->DAL )

and see if the error goes away.

However, if I may make another suggestion. You are using this var, oDPre, to signify a character value (the alias). The "o" prefix standardly signifies an object datatype not a character datatype. This makes your code harder to understand, so it would be better to use "cDPre" or better yet, "cAlias."

Better yet would be to use a database object. Then you can use syntax like oDPre:DAL and you don't have to use aliases at all.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: rango dates

Postby Silvio » Wed Jun 17, 2009 3:59 pm

I call oDpre because

oDPre:=Open_Dbf("Cotiza")

I use this function from 7 year
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: rango dates

Postby Silvio » Wed Jun 17, 2009 4:03 pm

James,
this is the last ?

set filter to alltrim((oDPre)->tipoattrez)) == cTipoAttrez .AND. (oDPre)->CAMERA == n ;
.AND. ;
(;
( dDataIniziale >= (oDPre)->DAL .AND. dDataIniziale <= (oDPre)->AL ) .OR.;
( dDataFinale >= (oDPre)->DAL .AND. dDataFinale <= (oDPre)->AL ) .OR. ;
( dDataIniziale < (oDPre)->DAL .AND. dDataFinale > (oDPre)->AL ) ;
)

the compilator make error


for this

set filter to alltrim((oDPre)->tipoattrez) == cTipoAttrez .AND. (oDPre)->CAMERA == n ;
.AND. ;
(;
( (oDPre)->DAL >= dDataIniziale .AND. (oDPre)->DAL <= dDataFinale ) .OR.;
( (oDPre)->AL >= dDataIniziale .AND. (oDPre)->AL <= dDataFinale );
)

the compilator runned ok


can you understand why the compilator make error ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: rango dates

Postby James Bott » Wed Jun 17, 2009 4:34 pm

Silvio,

I call oDpre because
oDPre:=Open_Dbf("Cotiza")
I use this function from 7 year.

I understand, I was just pointing out that the name "oDPre" signifies that it is an object and you are returning a character data type from the function, not an object. So, oDPre should really be cDPre.

this is the last ?

set filter to alltrim((oDPre)->tipoattrez)) == cTipoAttrez .AND. (oDPre)->CAMERA == n ;
.AND. ;
(;
( dDataIniziale >= (oDPre)->DAL .AND. dDataIniziale <= (oDPre)->AL ) .OR.;
( dDataFinale >= (oDPre)->DAL .AND. dDataFinale <= (oDPre)->AL ) .OR. ;
( dDataIniziale < (oDPre)->DAL .AND. dDataFinale > (oDPre)->AL ) ;
)


No, this is the last:

Code: Select all  Expand view
set filter to alltrim((oDPre)->tipoattrez)) == cTipoAttrez .AND. (oDPre)->CAMERA == n ;
.AND. ( dIniziale <= (oDPre)->AL .AND. dFinale >= (oDPre)->DAL )


Try it and I don't think you will get an error. This replaces the filter above.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: rango dates

Postby Silvio » Wed Jun 17, 2009 4:56 pm

I made :


set filter to alltrim((oDPre)->tipoattrez)) == cTipoAttrez .AND. (oDPre)->CAMERA == n ;
.AND. ( dDataIniziale <= (oDPre)->AL .AND. dDataFinale >= (oDPre)->DAL )

Compiling 'source\RIV220.prg'...
source\RIV220.prg(261) Error E0030 Syntax error: "syntax error at 'FILTER'"
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: rango dates

Postby James Bott » Wed Jun 17, 2009 5:22 pm

Silvio,

You have an extra paren (shown in red).

set filter to alltrim((oDPre)->tipoattrez)) == cTipoAttrez .AND. (oDPre)->CAMERA == n ;
.AND. ( dDataIniziale <= (oDPre)->AL .AND. dDataFinale >= (oDPre)->DAL )

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: rango dates

Postby Silvio » Wed Jun 17, 2009 8:16 pm

sorry... thanks..here there is very hot....

but I want understand

On a dialog I have a similar problem :

to insert a new order I want to control for sample

if the umbrella number 264 have an order on period date I want found


I know and the user insert this data :

the number of umbrellas (n)
the type of umbrellas (type)
the initial date ( dData1)
the end date (dData2)

I wank make a function must return me a value .t. if found a record .f. if it not found any record


I made :

Function Isfree(dData1,dData2,n,type)
Local lvalue:=.f.

(oDPre)->(OrdSetFocus(3)) // order on umbrellas numbers

set filter to alltrim((oDPre)->tipoattrez) == type .AND. (oDPre)->CAMERA == n ;
.AND. ( dData1 <= (oDPre)->AL .AND. dData2 >= (oDPre)->DAL )

(oDPre)->(DbGoTop())
DO WHILE !(oDPre)->(EoF())

lvalue:=.t.

(oDPre)->(DbSkip())
ENDDO

return lvalue



why it return me alway .t. ?

where I make error ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: rango dates

Postby Silvio » Wed Jun 17, 2009 8:39 pm

perhaps I found the solution :
Function Isfree(dData1,dData2,n,type)
Local lvalue:=.f.
(oDPre)->(OrdSetFocus(3)) // order on umbrellas numbers
(oDPre)->(DbGoTop())
DO WHILE !(oDPre)->(EoF())
IF alltrim((oDPre)->tipoattrez) == type .AND. (oDPre)->CAMERA == n ;
.AND. ( dData1 <= (oDPre)->AL .AND. dData2 >= (oDPre)->DAL )
lvalue:=.t.
endif
(oDPre)->(DbSkip())
ENDDO
return lvalue
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: rango dates

Postby ukoenig » Thu Jun 18, 2009 1:09 pm

Silvio,

this is the solution, I have shown You in Your other post.
But don't do DBGOTOP. Use DBSEEK, because there is a index and EXIT the loop after Number-change.
Look at Your other post !

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: rango dates

Postby Silvio » Thu Jun 18, 2009 1:38 pm

james,Otto,

I try to use your code and run ok but I'm afraid that not all cases have been closed

is OK for some case but not all cases, and I fear that the end user will have problems when he 'll use my application
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: rango dates

Postby Otto » Thu Jun 18, 2009 2:19 pm

Hello Silvio,

Please post some screen shots what you really want to reach and a test program with the current source.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: rango dates

Postby James Bott » Thu Jun 18, 2009 4:46 pm

Silvio,

I try to use your code and run ok but I'm afraid that not all cases have been closed

is OK for some case but not all cases


We need an example of a case where it doesn't work.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: rango dates

Postby James Bott » Thu Jun 18, 2009 4:48 pm

Silvio,

Try this:

Code: Select all  Expand view
  SET FILTER ...
   (oDPre)->(DbGoTop())
   lFree:=.t.
   if ! (oDPre)->(eof())
      lFree:= .f.
   endif
 
return lFree


About the general process of selecting an umbrella, what does the user do when the desired umbrella is not free? Do they have to keep guessing at new dates or new umbrellas? I would think it would be better to display the entire beach graphic for the specified range of dates, and show all the umbrella's statuses, free or available. Then the user can pick a free umbrella for the desired dates.

Another very useful feature would be to show all the dates that a certain umbrella is reserved, so the user could select an available date range.

I don't think it is very useful to just have the user check the desired date range for a particular umbrella. This will leave them to do a lot of trial and error guessing if the desired range and/or umbrella is not available.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 89 guests