FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour rango dates
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: rango dates
Posted: Wed Jun 17, 2009 03: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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: rango dates
Posted: Wed Jun 17, 2009 03: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: rango dates
Posted: Wed Jun 17, 2009 03:59 PM

I call oDpre because

oDPre:=Open_Dbf("Cotiza")

I use this function from 7 year

Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: rango dates
Posted: Wed Jun 17, 2009 04: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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: rango dates
Posted: Wed Jun 17, 2009 04: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 (fw): Select all Collapse
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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: rango dates
Posted: Wed Jun 17, 2009 04: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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: rango dates
Posted: Wed Jun 17, 2009 05: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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: rango dates
Posted: Wed Jun 17, 2009 08: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)-&gt;(DbSkip())
         ENDDO

return lvalue

why it return me alway .t. ?

where I make error ?

Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: rango dates
Posted: Wed Jun 17, 2009 08: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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: rango dates
Posted: Thu Jun 18, 2009 01: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.
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: rango dates
Posted: Thu Jun 18, 2009 01: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
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: rango dates
Posted: Thu Jun 18, 2009 02: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

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: rango dates
Posted: Thu Jun 18, 2009 04: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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: rango dates
Posted: Thu Jun 18, 2009 04:48 PM
Silvio,

Try this:

Code (fw): Select all Collapse
   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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion