topic stringlengths 1 63 | text stringlengths 1 577k ⌀ |
|---|---|
file di excel protetto da password | Non devi lasciare i parametri a NIL. La documentazione è quella che danno con Office, i file VBA*.CHM.
EMG |
file to FTP | Hi, all !
I have total access to directory ftp. How I can copy file to this directory ? |
file to FTP | Natter, have you tried with:
FTPPutFile( hConnect, cUpFile, cUpFile, 0, 0 )
best regards,
Otto |
file to FTP | Otto, thanks for your help.
What is "nConnect" ? What use - TFTP or TFTPClient ? |
file to FTP | Natter,
I use this code for FtpGetFile. But I think this should also work with FtpPutFile.
Best regards,
Otto
[code=fw:1t0ziiqq]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">// Testing the FiveWin new Internet Classes</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> oWnd, oTmr<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Timers"</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">TIMER</span> oTmr <span style="color: #0000ff;">INTERVAL</span> <span style="color: #000000;">10000</span> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span>oTmr:<span style="color: #000000;">DeActivate</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>,oWnd:<span style="color: #0000ff;">Say</span><span style="color: #000000;">(</span> <span style="color: #000000;">10</span>, <span style="color: #000000;">17</span>, Time<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, upload<span style="color: #000000;">(</span><span style="color: #000000;">)</span>,oTmr:<span style="color: #0000ff;">Activate</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #0000ff;">of</span> oWnd<br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">TIMER</span> oTmr<br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd ;<br /> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CLICK</span> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Click!"</span> <span style="color: #000000;">)</span><br /><br /> oTmr:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br />FUNC upload<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> oInternet := TInternet<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> oFTP := TFTP<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"ftp.test.info"</span>, oInternet,<span style="color: #ff0000;">"testinfo"</span>, <span style="color: #ff0000;">"test"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> aFiles<br /> <span style="color: #00C800;">LOCAL</span> handle<br /> <span style="color: #00C800;">local</span> cFile := <span style="color: #ff0000;">""</span><br /><br /> <span style="color: #00C800;">if</span> ! Empty<span style="color: #000000;">(</span> oFTP:<span style="color: #000000;">hFTP</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">/*<br />DLL32 FUNCTION FtpSetCurrentDirectory(<br />hFTP AS LONG,<br />cDirName AS LPSTR ) ;<br />AS BOOL PASCAL ;<br />*/</span><br /> FtpSetCurrentDirectory<span style="color: #000000;">(</span>oFTP:<span style="color: #000000;">hFTP</span>, <span style="color: #ff0000;">"/testinfo/STB1/"</span><span style="color: #000000;">)</span><br /> aFiles = oFTP:<span style="color: #000000;">Directory</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"*.*"</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> len<span style="color: #000000;">(</span>aFiles<span style="color: #000000;">)</span> > <span style="color: #000000;">0</span><br /><br /> AEval<span style="color: #000000;">(</span> aFiles, <span style="color: #000000;">{</span> | aFile | <span style="color: #0000ff;">msginfo</span><span style="color: #000000;">(</span> aFile<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> <span style="color: #000000;">)</span>,cFile := ALLTRIM<span style="color: #000000;">(</span> aFile<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> <span style="color: #000000;">)</span>,;<br /> FtpGetFile <span style="color: #000000;">(</span>oFTP:<span style="color: #000000;">hFTP</span>,aFile<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>, <span style="color: #ff0000;">"c:<span style="color: #000000;">\d</span>bf<span style="color: #000000;">\"</span> + aFile[ 1 ] ,.t.,0,0,0 ) ,;<br /> oFTP:DeleteFile( aFile[ 1 ]) } )<br /><br /> ENDIF<br /><br /><br />/*<br />DLL32 FUNCTION FtpGetFile(<br />hFTP AS LONG, = INTERNETCONNECT<br />cRemoteFile AS LPSTR<br />cLocalFile AS LPSTR<br />lOverWrite AS LONG<br />n1 AS LONG<br />n2 AS LONG<br />n3 AS LONG<br />*/<br /><br />else<br /> MsgAlert( "</span>oFTP:<span style="color: #000000;">hFTP</span> is <span style="color: #00C800;">null</span><span style="color: #ff0000;">" )<br />endif<br /><br />oInternet:End()<br /><br />//MsgInfo( "</span>Done!<span style="color: #ff0000;">" )<br /><br />return nil<br /><br />//----------------------------------------------------------------------------//<br /></span></div>[/code:1t0ziiqq] |
file to FTP | Copy file from FTP to local computer I do with URLDownloadToFile() - it work fine.
If do FTPPutFile() from TFTP then It's not work. |
file to FTP | Natter, what error do you get?
Best regards,
Otto |
file to FTP | I not get error, but and file not copy to FTP |
file to FTP | Natter,
how do you test that you have full access as you write in your first post?
if FTPPUTFILE( hConnect, CurDir() +"\"+ aInfo[I,1], "/testinfo/STB1/"+aInfo[I,1], 0, 0 )=.t.
I have some FTP servers where the name for example is
test.info and the directory STB1.
Via http:// I can use <!-- w --><a class="postlink" href="http://www.test.info/STB1">www.test.info/STB1</a><!-- w --> but
/STB1 does not work via FTP.
I have to use to access via FTP /testinfo/STB1 .
Best regards,
Otto |
file to FTP | I do then :
function Main()
local oInternet := TInternet():New()
local oFTP := TFTP():New( "ftp.MyFtp", oInternet, login, password )
? oFTP = object
? oFTP:hFtp >0
? FTPPutFile( oFTP:hFtp, LocalFile, FtpFile, 0, 0 ) = .F.
return NIL
Examle .\samles\ftpdir.prg with this parameters work fine |
file() -returns .f. when file is present? | Hi.
I'm checking for file existence using file( cfile ). It returns false. However when I check the directory, I see the file is present.
This is the file I'm checking for:
[quote:kg1qm2dh]
C:\Users\ADMINI~1\LOCALS~1\Temp\page001.png
[/quote:kg1qm2dh]
Here is the actual code snippet:
[code=fw:kg1qm2dh]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> <span style="color: #00C800;">LOCAL</span> cDir := GetTempDir<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />...<br /><br /> WinExec<span style="color: #000000;">(</span><span style="color: #ff0000;">"gswin32c -dBATCH -dNOPAUSE -r150 -sDEVICE=png16m "</span>+;<br /> <span style="color: #ff0000;">"-dTextAlphaBits=4 -sOutputFile="</span> + cDir + <span style="color: #ff0000;">"page%03d.png "</span> +;<br /> cFile, <span style="color: #000000;">0</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">//------------ just for debugging ---------------</span><br /> cPrnFile := cDir + <span style="color: #ff0000;">"page"</span>+StrZero<span style="color: #000000;">(</span> i, <span style="color: #000000;">3</span> <span style="color: #000000;">)</span>+<span style="color: #ff0000;">".png"</span><br /> logfile<span style="color: #000000;">(</span> <span style="color: #ff0000;">"trace.log"</span>, <span style="color: #000000;">{</span> cPrnFile, file<span style="color: #000000;">(</span> cPrnFile <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">//---------------------------------------------------</span><br /> <br /> <span style="color: #00C800;">WHILE</span> FILE<span style="color: #000000;">(</span> cPrnFile := cDir + <span style="color: #ff0000;">"page"</span>+StrZero<span style="color: #000000;">(</span> i, <span style="color: #000000;">3</span> <span style="color: #000000;">)</span>+<span style="color: #ff0000;">".png"</span> <span style="color: #000000;">)</span><br /><br /> ::<span style="color: #000000;">oPrn</span>:<span style="color: #000000;">StartPage</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">oPrn</span>:<span style="color: #000000;">SayBitmap</span><span style="color: #000000;">(</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, cPrnFile <span style="color: #000000;">)</span><span style="color: #B900B9;">//, nWidth, nHeight, nRaster )</span><br /> ::<span style="color: #000000;">oPrn</span>:<span style="color: #0000ff;">EndPage</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> logfile<span style="color: #000000;">(</span> <span style="color: #ff0000;">"trace.log"</span>, <span style="color: #000000;">{</span> cPrnFile <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> i++<br /><br /> END<br /> </div>[/code:kg1qm2dh]
Here the function file() is always returning .f. even when the file does exists.
Any ideas what could be wrong?
Reinaldo. |
file() -returns .f. when file is present? | Never mind. I found the problem.
Thank you,
Reinaldo. |
file() -returns .f. when file is present? | Hello Reinaldo,
what was the problem?
Best regards,
Otto |
file() -returns .f. when file is present? | Hi Otto;
The problem was timing. WinExec() hadn't finished before the check for file() was being executed. I changed WinExec for Waitrun() and that fixed the timing problem.
Thank you,
Reinaldo. |
file() -returns .f. when file is present? | Hello Reinaldo,
I only ask becouse I had similar problems when SMB 2 were on.
Search the forum for SMB.
Best regards,
Otto
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=21740&p=115743&hilit=smb#p115743">viewtopic.php?f=3&t=21740&p=115743&hilit=smb#p115743</a><!-- l --> |
file() function | I'm tryin to use the file() function to check if a file in the foldere "\My documents\immagini\" exists, but the function always returns .f. even if the file is there....Any help ?? |
file() function | Andrea,In Windows Mobile there is no the concept of "drives", so we have to use the current directory. Please try this example:test.prg[code:gu7c3pgh]
#include "fwce.ch"
function Main()
MsgInfo( File( CurDir() + "\test.exe" ) )
return nil
[/code:gu7c3pgh] |
file() function | Andrea,You just have to remove the first slash bar:test.prg[code:1xymmd9b]
#include "fwce.ch"
function Main()
MsgInfo( File( "My Documents\myfile.txt" ) )
return nil
[/code:1xymmd9b] |
file() function | thank you Antonio, everything works fine now.There was a too little bug to be seen in my code! |
fileXLSxH.LIB | Amigos
Cual será la ultima versión de: fileXLSxH.LIB
gracias
david |
fileXLSxH.LIB | David;
la última que tengo es de enero de 2012
pasame tu correo si la necesitas |
fileXLSxH.LIB | Muchas Gracias
<!-- e --><a href="mailto:davidbarrio_arg@hotmail.com">davidbarrio_arg@hotmail.com</a><!-- e -->
david |
filecopy not run | i made
cImgPath := ".\images\"
Filecopy( lfn2sfn(rtrim(EL->ELIMGLIB)), cImgPath+cFileLib)
sometimes save the file but many times not save any files
any solution ? |
filecopy not run | Silvio,
I'm using path-vars.
Never noticed any problem
[color=#0000FF:96xsa652]c_path := cFilePath(GetModuleFileName( GetInstance() ) ) // Main-path
c_path1 := c_path + "IMAGES\"
c_path2 := c_path + "CAPTURES\"
oImage:LoadBmp( c_path1 + cImage )[/color:96xsa652]
regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
filecopy not run | yes Uwe
my problem is another
I explain you
when an end user wants to insert an image he selects the image from his computer in any part or from his usb stick and inserts the name and image in the ELIMGLIB field of the item.dbf archive. the procedure must copy this file from the source and must save it in the folder. \ images \ which is in the root of the EXE program and then in the ELIMGLIB field it must save the new connection ie. \ images \ image.png
To copy the image file from the computer to the folder. \ Images \ I tried the filecopy () function but there are problems and last night I found in the folder fivewin (gallery) a procedure called copyfiles that seems to work better but has a 'interface with a dialog I wanted to try if you can remove this dialog and call the copying function directly but for now I can not waste time enough. |
fileedit | Hello,
does someone has a fileedit.exe which is working under 32 bit.
Best regards,
Otto |
fileedit | What does fileedit.exe do? |
fileedit | Dear Mr. Rao,
fileedit is for editing EASYREPORTs definition files.
Thanks to xBrowse it was not a big task to Change this old Clipper / canal5 code to current Version.
Best regards,
Otto
[img:3laefvvj]http://www.atzwanger-software.com/fw/fileedit1.jpg[/img:3laefvvj] |
fileedit | Hey Otto,
With some changes, this program could be used for editing resource files.
Like Tim, I'm mostly changing them in a txt editor, but with this, it can be done in Xbrowse.
Is it a option to change it for resources ?
Marc |
fileedit | Marc,
Please review FWH\samples\re.prg
It is a work (still) in progress (my fault) but it uses very interesting concepts <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
fileedit | Antonio,
I didn't know it. Looks promissing.
Maybe Mr. Rao can put a Xbrowse into it for edit the resource file
From there on, we can change the sample like every user whiches ?
Marc |
fileedit | Antonio,
one quick update please..
If you change the resource data, the RUN command will always show the initial data.
Could you change that ? I can use it than to show the dialogs instead op Pelles. |
fileedit | Dear Otto
[img:170gblv9]https://s17.postimg.org/o8ukn8v7j/Fileedit.png[/img:170gblv9] |
fileedit | Marc,
[quote="Marc Venken":1ks42xg2]Antonio,
one quick update please..
If you change the resource data, the RUN command will always show the initial data.
Could you change that ? I can use it than to show the dialogs instead op Pelles.[/quote:1ks42xg2]
Here you have it <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=35193&start=0">viewtopic.php?f=3&t=35193&start=0</a><!-- l --> |
fileedit | Thanks.
We test it. |
filelog | Would it be possible to have a crypt possibility to the filelog function and if yes how would the decrypt be handled?
Thanks in advance
Otto |
filelog | Otto,
You can use FWH functions Encrypt() and Decrypt():
[url:2dwig6z4]http://wiki.fivetechsoft.com/doku.php?id=fivewin_function_encrypt[/url:2dwig6z4]
[url:2dwig6z4]http://wiki.fivetechsoft.com/doku.php?id=fivewin_function_decrypt[/url:2dwig6z4]
i.e.:
MemoWrit( "file.log", Encrypt( MemoRead( "another.log" ) ) )
MsgInfo( Decrypt( MemoRead( "file.log" ) ) ) |
filelog | Hello Antonio,
thank you. But I would like to decrypt the text before writing to the disk but after filelog made of all the single array entries a string.
Do you think this is possible?
Thanks in advance
Otto |
filelog | Otto,
Is it for error.log or for another log file ?
What function or code do you use to create the log file ? |
filelog | Hello Antonio,
logfile( Setup():Daten + "protokoll\log" + dtos(date()) + ".txt",;
{ "SaveStandard", ::oZiRg:code,::oZiRg:USER_TIME,::LEdit,::oZiRg:artnum, ::oZiRg:bezeichnun, ::oZiRg:Menge, ::oZiRg:preis } )
I would like to use it for program intern protocols.
The different elements could be of different values.
These protocols should only be readable for service techniques in case the is a problem.
Best regards,
Otto |
filelog | Otto,
Have you tried with :
{ Encrypt( "SaveStandard" ), Encrypt( ::oZiRg:code ), Encrypt( ::oZiRg:USER_TIME ), Encrypt( ::LEdit ), Encrypt( ::oZiRg:artnum ), ...
each value must be of character type. If not then use Encrypt( cValToChar( ... ) ) |
fill fields in Internet explorer | In Vb u can fill fields
like
On Error Goto ErrHandler
With WebBrowser1.Document.Forms(0)
' Eingabefelder ausfüllen
.elements("username").Value = "Ihr Benutzername"
.elements("password").Value = "Ihr Kennwort"
' Formular abschicken
.Submit
End With
On Error Goto 0
Exit Sub |
filter database using tdata class | I am trying to use James class tdata to filter a database using the below code :
[code:25f14nqd]
//--- meter class
class Tmeter from TData
method new
method browser
method add
method edit
method filterreads
message delete method _delete
Hidden:
data lAdd as logical
endclass
//---------------------------------------------------------------------------//
method new()
super:new(,"mete",,.f.)
if ::use()
::addIndex("mete")
::addIndex("mete2")
::setOrder(1)
::gotop()
msgInfo( ::reccount(),"reccount()")
msgInfo( ::fcount(),"fcount()")
endif
::lAdd:=.f.
return self
method browser()
local oDlg,oBrw,oMeter,oFont,oCol,nFor,oChild
::setOrder(2)
::gotop()
define font oFont name "Ms Sans Serif" size 0,-14 BOLD
DEFINE DIALOG oDlg FROM 0,0 TO 45,128 TITLE "meter reads browse "
oBrw := TXBrowse():New( oDlg )
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:lColDividerComplete := .t.
oBrw:nHeaderLines := 1
oBrw:nFooterLines := 1
oBrw:nDataLines := 1
oBrw:lFooter := .t.
oBrw:CreateFromCode()
oBrw:nTop = 0
oBrw:nLeft = 0
oBrw:nWidth = 1000
oBrw:nHeight =600
oBrw:SetRDD()
for nFor := 1 to ::Fcount()
oBrw:aCols[ nFor ]:oDataFont := oFont
next
// Setup for using database class
oBrw:cAlias:= ::cAlias
oBrw:bSkip:= {|nRecs| ::skipper( nRecs ) }
oBrw:bGotop:= {|| ::gotop() }
oBrw:bGoBottom:= {|| ::goBottom() }
oBrw:bBookMark := {| n | iif( n == nil, ::RecNo() , ::Goto( n ) ) }
oMeter:= self
ACTIVATE DIALOG oDlg ON INIT (oBrw:SetSize( 1000, 600 ), BuildButtons( oMeter,oBrw,oDlg),oBrw:Refresh(.t.), oDlg:Refresh(.t.))
RETURN nil
//---------------------------------------------------------------------------//
function BuildButtons(oMeter, oBrw, oDlg)
*--------------------------------------------------
@ 34, 1 BUTTON "&New" OF oDlg SIZE 60, 20 ACTION ( oMeter:add(oBrw),oBrw:refresh(),oDlg:update())
@ 34, 15 BUTTON "&Modify" OF oDlg SIZE 60, 20 ACTION ( oMeter:edit(oBrw),oBrw:refresh(),oDlg:update())
@ 34, 30 BUTTON "&Delete" OF oDlg SIZE 60, 20 ACTION ( oMeter:delete(oBrw,oMeter))
@ 34,45 BUTTON "&Search" OF oDlg SIZE 60, 20 //ACTION addmete( oBrw , oDlg )
@ 34,60 BUTTON "&Print" OF oDlg SIZE 60, 20 //ACTION oDlg:Report ( "meter reads Report", .t. )
@ 36, 1 BUTTON "&Order" OF oDlg SIZE 60, 20//ACTION ordercust(oLbx) SIZE 40, 12
@ 36, 5 BUTTON "&Filter" OF oDlg SIZE 60, 20 ACTION ( oMeter:filterreads(oBrw),oBrw:refresh(),oDlg:update())
@ 36, 30 BUTTON "&Unfilter" OF oDlg SIZE 60, 20//ACTION Nonfiltercust(oLbx) SIZE 40, 12
@ 36, 45 BUTTON "&Exit" OF oDlg SIZE 60, 20 //ACTION oDlg:End() SIZE 40, 12
return nil
method add(oBrw)
*---------------
::lAdd:=.t.
::edit(oBrw)
::load() // in case they cancel
::lAdd:=.f.
::GOTOP()
return self
//---------------------------------------------------------------------------//
method edit(oBrw)
*---------------
local oDlg,oBtnNew
local ometer:= TRecord():new( self )
if ::lAdd
ometer:blank()
endif
DEFINE DIALOG oDlg FROM 8, 2 TO 600, 700 PIXEL ;
TITLE if(::lAdd,"Untitled","Update")
@ 1,2 SAY "&Serial" OF oDlg PIXEL
@ 1,50 SAY ":" OF oDlg PIXEL
@ 1,60 GET ometer:me_mc_serl OF oDlg PIXEL UPDATE
@ 15,1 SAY "&Meter date" OF oDlg PIXEL
@ 15,50 SAY ":" OF oDlg PIXEL
@ 15,60 GET ometer:me_date pict ("99/99/9999") OF oDlg PIXEL UPDATE
@ 280, 10 BUTTON oBtnNew PROMPT "&Save" OF oDlg PIXEL SIZE 30, 12 ;
ACTION ( ometer:save(), oDlg:end() )
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( oBrw:Refresh(), oDlg:Update() )
ometer:end()
oDlg:update()
return self
//---------------------------------------------------------------------------//
method _delete(oBrw,oMeter)
*------------------------
if msgYesNo("Delete this record?")
super:delete()
oMeter:blank()
oMeter:save()
endif
::skip(1)
::skip(0)
if oBrw:eof()
::skip(-1)
::skip(0)
endif
oBrw:refresh()
return self
//---------------------------------------------------------------------------//
CLASS TXData from TData
METHOD Append()
METHOD filterreads()
MESSAGE Delete METHOD _Delete()
endclass
//---------------------------------------------------------------------------//
METHOD _Delete()
::blank()
::save()
return super:delete()
//---------------------------------------------------------------------------//
method filterreads(oBrw)
*----------------------
local oDlg,oBtnNew
local ometer:= TRecord():new( self )
local V_me_mc_serl,y,cfilter,bfilter:=""
if MsgGet( "Serial Machine", "Enter Serial Machine", @V_me_mc_serl,;
"" )
select 3
use mach
set index to mach5
if ! DbSeek( (V_me_mc_serl ))
MsgAlert( "I don't find that serial" )
endif
endif
y := "'"+padr(V_me_mc_serl,7)+"'"
cFilter := "me_mc_serl = "+ y
bFilter = "{||"+cFilter+"}"
select mete
use mete
set index to mete1
DBSETFILTER(&bFilter,cFilter)
mete->(DBGOTOP())
ometer:end()
oDlg:update()
return self
[/code:25f14nqd] |
filter database using tdata class | Ehab,
I see a few things wrong with just a quick look. I have mentioned this before--you MUST use the CLASS clause with methods when defining more than one class in a single PRG. You cannot do:
method new()
You MUST do:
method new() CLASS TMeter
Otherwise the compiler doesn't know which class each method belongs to. You need to do this for EVERY method in your PRG.
Also, you are not understanding that TMeter is a database object. You don't want to open another copy of the same database to do the fiiltering, you filter the one you already have open. So change this code:
select mete
use mete
set index to mete1
DBSETFILTER(&bFilter,cFilter)
mete->(DBGOTOP())
To this:
(::cAlias)->(dbsetfilter(&bFilter,cFilter))
::gotop()
There are other problems too. You have a TXData class defined but you are not inheriting from it to make the TMeter class. Was that your intent?
Let me explain my concept of TXData. This is just the name I picked for a class that exists between TData and any database classes that you create. Start it as an empty class.
class TXData from TData
endclass
That is all you need. Then create your other classes from it.
class TMeter from TXData
...
endclass
OK, what is the point you ask? Later when you wish to make some change in behavior that you want all your database to inherit, you an add it to the TXData class. For example, lets say you want to reuse deleted records. You can add the code to do that in TXData, then TMeter and any other database class that you have created will automatically inherit the ability to reuse deleted records.
You also have an append() method defined in the TXData class that does not exist. I suggest removing the append method, and moving the FilterReads() method to the TMeter class.
Regards,
James |
filter on tdabase | I have a dbf open with tdatabase a with filter and I wish add another filter
But the function FiltraBase make error because probable not run the setfilter command
and I made
I open two area of Tariffe.dbf
1. oTariffeOneDay
2. oTariffeMulti
have the filter
cFilter1 := 'FIELD->GIORNI=1' //oneday
cFilter2 := 'FIELD->GIORNI>1' //from 2 to x
oTariffeOneDay:= TTariffe():new()
oTariffeOneDay:setFilter( cFilter1)
oTariffeOneDay:gotop()
oTariffeMultipli:= TTariffe():new()
oTariffeMultipli:setFilter(cFilter2)
oTariffeMultipli:gotop()
Now I wish change the filter selecting the combobox
on the combobox I insert
@ 36,75 COMBOBOX cFilter ITEMS ArrTranspose( aListini )[ 1] ;
SIZE 100,400 PIXEL OF oDlgTariffe;
ON CHANGE FiltraBase(oBrw1,cfilter,aListini,cFilter1,oTariffeOneDay)
Function FiltraBase(oBrw1,cfilter,aListini,oTariffeOneDay)
// make a filter on otariffeoneday
oTariffeOneDay:setfilter(trim(oTariffeOneDay:idlistino)==Search_cod(cFilter,alistini) .AND. oTariffeOneDay:GIORNI=1 )
oTariffeOneDay:gotop()
oBrw1:refresh()
return nil
//-------------------------------------------------------------------------------------------------------------------------------------------------//
Function Search_cod(cFilter,alistini)
Local nAt := AScan( alistini, { |a| a[ 1 ] == cFilter } )
Local cCode:="01" //primo record
If nAt>0
cCode:= alistini[nAt][2]
endif
return cCode |
filter on tdabase | Try:
cX := Search_cod(cFilter,aListini)
oTariffeOneDay:setFilter( "IDListNo == " + cX + " .and. giorni=1" ) |
filter on tdabase | Application
===========
Path and name: C:\Work\Errori\tariffe_james\tariffe.Exe (32 bits)
Size: 4,210,176 bytes
Compiler version: Harbour 3.2.0dev (r1703231115)
FiveWin version: FWH 18.12
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200
Time from start: 0 hours 0 mins 7 secs
Error occurred at: 23-01-2019, 21:26:14
Error description: Error BASE/1004 No exported method: SETFILTER
Args:
[ 1] = C FIELD->GIORNI=1
[ 2] = C IDListiNo == 02 .and. giorni=1 |
filter or where statement in SQL | Hi Mr. Rao,
I want to clarify my mind.
We can create rowset without any sql statement and next set filter.
[code=fw:mvuibafu]<div class="fw" id="{CB}" style="font-family: monospace;">oRs:=oCn:<span style="color: #000000;">RowSet</span><span style="color: #000000;">(</span><span style="color: #ff0000;">'bigdata'</span><span style="color: #000000;">)</span><br />oRs:<span style="color: #000000;">SetFilter</span><span style="color: #000000;">(</span><span style="color: #ff0000;">'datano = 555'</span><span style="color: #000000;">)</span></div>[/code:mvuibafu] In this situation, load all table to client.
To change condition, oRs:SetFilter('datano=666') again.
or
with sql statement.
[code=fw:mvuibafu]<div class="fw" id="{CB}" style="font-family: monospace;">oRs:=oCn:<span style="color: #000000;">RowSet</span><span style="color: #000000;">(</span><span style="color: #ff0000;">'select * from bigdata where datano = ?'</span>, <span style="color: #000000;">{</span><span style="color: #000000;">555</span><span style="color: #000000;">}</span><span style="color: #000000;">)</span></div>[/code:mvuibafu] In this situation, load just my desired part of table to client.
To change condition, oRs:ReQuery({666})
My goal is change condition just two times. Which one is suitable for me. Which one is faster?
Thanks. |
filter or where statement in SQL | Both work.
Let us now see the pros and cons of the two approaches.
1st method:
- Reads the entire table in the beginning itself. If it is a big table and we do not need all the rows lot of time, server and network resources are wasted
- Once read, we can change filters any number of times and there is no strain on server or network resources.
2nd method.
- Only required records are retrieved from the server.
- But each time we change the filter/where condition, we need to retrieve the new data again. Everytime this places strain on server and network resources.
So, depending on the size of the table and how large part of the table we will be needing we need to choose one of these methods.
It is a case to case decision.
Normally it is a good idea to reduce strain on server and network resources.
For example:
Sorting at the client is better than sorting on the server. |
filter or where statement in SQL | Hi Mr. Rao,
[code=fw:39ocvbqt]<div class="fw" id="{CB}" style="font-family: monospace;">oRs := oCn:<span style="color: #000000;">RowSet</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"select * from `customer` where `state` = ? and 'age' between ? and ?"</span>, <span style="color: #000000;">{</span> cState, nMinAge, nMaxAge <span style="color: #000000;">}</span> <span style="color: #000000;">)</span></div>[/code:39ocvbqt]
There is a data "Source" in FWMARIAROWSET. We can see sql statement like "select * from `customer` where `state` = ? and 'age' between ? and ?"
Is there any data to see current Query variables? (not names) like {"NY",51,60}
Edit : Is there any method to inspect FWMARIAROWSET as an object with xbrowser? |
filter or where statement in SQL | Yes
[code=fw:1jcz9hlw]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oRs:<span style="color: #000000;">aParams</span> <span style="color: #B900B9;">// undocumented.</span><br /> </div>[/code:1jcz9hlw]
We request not to use any undocumented data and rely on it in your application program. We suggest you store the current values of these parameters in your application program and also do not change oRs:aParams yourself.
These classes are complex and there are many methods and data for internal use. We need to keep them for ourselves to retain enough flexibility for future developments.
We, therefore, request you to use only the datas/methods documented in WiKi and subsequent WhatsNew.Txt. |
filter or where statement in SQL | [quote="nageswaragunupudi":1d32zoiv]Yes
[code=fw:1d32zoiv]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oRs:<span style="color: #000000;">aParams</span> <span style="color: #B900B9;">// undocumented.</span><br /> </div>[/code:1d32zoiv]
We request not to use any undocumented data and rely on it in your application program. We suggest you store the current values of these parameters in your application program and also do not change oRs:aParams yourself.
These classes are complex and there are many methods and data for internal use. We need to keep them for ourselves to retain enough flexibility for future developments.
We, therefore, request you to use only the datas/methods documented in WiKi and subsequent WhatsNew.Txt.[/quote:1d32zoiv]
Thank you Mr. Rao.
I want to ask something if it is possible.
We have a oRs object.
We create oBrw xbrowse using as a datasource oRs.
Is oRs and oBrw:oDbf objects are same object? or when you create xbrowse clone oRs to oDbf?
After creating xbrowse, if I change to Query of oRs, will oBrw:oDbf change? |
filter or where statement in SQL | Hi,
I think oBrw:oDbf is clone and another object.
Another question. When I set to new params with ReQuery(), browse design is gone. Which methods should run after requery? |
filter or where statement in SQL | oBrw:oDbf is the same as (Rowset object). It is not a clone.
When building xbrowse, oBrw:oDbf is set to oRs by using
[code=fw:2mxj7kbh]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oBrw:<span style="color: #000000;">oDbf</span> := oRs<br /> </div>[/code:2mxj7kbh]
After oRs:Requery( aNewParams ), present records are replaced by new records, but fields and columns are not changed. Therefore no changes in the browse are required. But you need to reposition the browse to the top.
Browse design is not gone.
[code=fw:2mxj7kbh]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oRs:<span style="color: #000000;">Requery</span><span style="color: #000000;">(</span> aNewParams <span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> </div>[/code:2mxj7kbh] |
filtering combo box according to entered variable | I am filtering a combo box of cities related to the country and filtering the govereners according to cities entered but there is a value must be refreshed to make that filtering active in the recent run . The filter is active in the next run of the module. My question what is missing in my code to make the filtering affected in active run .
Here is the code :
[code:2m4zb09h]
cFilter :=""
@ 45,2 SAY "&Country" OF oDlg PIXEL
@ 45,50 SAY ":" OF oDlg PIXEL
@ 45,200 COMBOBOX oCbx VAR v_co_cocmbo ITEMS aBase(1,"cust",256,"cu_coun",cfilter) size 110,80 ;
OF oDlg PIXEL;
ON CHANGE (oGet:VarPut(PADR(v_co_cocmbo,30)),oGet:Refresh())
@ 45,60 GET oGet VAR cu_coun OF oDlg PIXEL
cFilter :="alltrim(upper("+"cust->cu_coun"+" ))" + '=="' + alltrim(upper(cu_coun)) + '"'
@ 60,2 SAY "&City" OF oDlg PIXEL
@ 60,50 SAY ":" OF oDlg PIXEL
@ 60,200 COMBOBOX oCbx2 VAR v_ci_cocmbo ITEMS aBase(1,"cust",256,"cu_city",cfilter) size 110,80 ;
OF oDlg PIXEL;
ON CHANGE (oGet2:VarPut(PADR(v_ci_cocmbo,30)),oGet2:Refresh())
@ 60,60 GET oGet2 VAR cu_city OF oDlg PIXEL
cFilter :="alltrim(upper("+"cust->cu_city"+"))" + '=="' + alltrim(upper(cu_city)) + '"'
@ 75,2 SAY "&Governer" OF oDlg PIXEL
@ 75,50 SAY ":" OF oDlg PIXEL
@ 75,200 COMBOBOX oCbx3 VAR v_go_cocmbo ITEMS aBase(1,"cust",256,"cu_gove",cFilter) size 110,80 ;
OF oDlg PIXEL;
ON CHANGE (oGet3:VarPut(PADR(v_go_cocmbo,30)),oGet3:Refresh())
@ 75,60 GET oGet3 VAR cu_gove OF oDlg PIXEL
FUNCTION aBase(workarea,dbf_na,arr_size,fld_na,cFilter)
//-------------------------------------
LOCAL arr:={},nAreaActiv:=Select()
LOCAL y:=0
local bFilter:=""
aAdd(arr,space(arr_size)) //Put First element empty
select (workarea)
use (dbf_na)
SELE (dbf_na)
DBGOTOP()
set filter to &(cFilter)
DBGOTOP()
go top
WHILE!Eof()
y:=ASCAN(arr,(dbf_na)->&fld_na)
if y==0
aAdd(arr,(dbf_na)->&fld_na)
dbSkip()
else
dbSkip()
endif
ENDDO
SELE (nAreaActiv)
RETURN(arr)
[/code:2m4zb09h] |
filtering combo box according to entered variable | Try using oCbx:SetItem() method.
EMG |
filtering combo box according to entered variable | I tried very hard to filter a combo box based on a get value but with no result . Recently I fixed my values from dbf and also I tried to filter cities belongs to their countries as following but do no work .
[code:qpum2typ]
select 5
use coun
index on upper(coun->coun_name) to coun
database oCoun
@ 45,2 SAY "&Country" OF oDlg PIXEL
@ 45,50 SAY ":" OF oDlg PIXEL
@ 45,180 dbcombo oCbx var v_co_cocmbo;
alias oCoun:cAlias;
size 100,200 pixel;
itemfield "COUN_CODE";
listfield "COUN_NAME";
of oDlg;
UPDATE
select 6
use city
index on upper(city->city_name) to city
database oCity
set filter to upper(city->coun_name)==upper(v_co_cocmbo)
city->(dbgotop())
@ 60,2 SAY "&City" OF oDlg PIXEL
@ 60,50 SAY ":" OF oDlg PIXEL
@ 60,180 dbcombo oCbx2 var v_ci_cocmbo;
alias oCity:cAlias;
size 100,200 pixel;
itemfield "CITY_CODE";
listfield "CITY_NAME";
of oDlg;
UPDATE
[/code:qpum2typ] |
filtering combo box according to entered variable | You have to set the filter in the ON CHANGE clause of the first DBCOMBO and then refresh (or refill?) the second DBCOMBO.
EMG |
filtering combo box according to entered variable | Still now I can not state the correct syntax for set filter with dbCombo ? Could you help me more ? |
filtering combo box according to entered variable | First, I don't understand why you have a GET in addition to the combobox. The combobox already contains a GET which in turn contains the selection of the user. I can't see any use for the additional GET containing the same information.
After a selection is made, you need to set a filter and then reload the next combobox. So for the first combobox you need something like the code below. I would not use ON CHANGE because that is going to reload the next combobox each time the selection is changed (when the combobox is scrolled it will reload for each record). You only want it reloaded after the control is exited, so I would use the VALID clause.
cFilter :=""
@ 45,2 SAY "&Country" OF oDlg PIXEL
@ 45,50 SAY ":" OF oDlg PIXEL
@ 45,200 COMBOBOX oCbx VAR v_co_cocmbo ITEMS aBase(1,"cust",256,"cu_coun",cfilter);
SIZE 110,80 ;
OF oDlg PIXEL;
VALID (reset( v_co_cocmbo, oCbx2, "cust" ), .t.)
function reset( cItem, oCbx, cFile )
local aItems:={}
local nArea:= select()
select 0
use (cFile)
set filter to cItem == cu_coun
go top
do while ! eof()
add(aItems,cu_coun)
skip
enddo
use
select( nArea )
oCbx:setItems( aItems )
oCbx:refresh()
return nil |
filtering combo box according to entered variable | Sir I tried the code I could not find the error,it does not work . Sir Let my explain again:
I am not filtering the combobox of countires (just no redundancy) (chosen firstly).
I am filtering the combobox of Cities in the cust file according to their countries(chosen secondly).
I am filtering the combobox of governers in the cust file according to their cities(chosen thirdly).
The file cust has all those data that may be in redundancy .
[code:1zmyem54]
@ 45,2 SAY "&Country" OF oDlg PIXEL
@ 45,50 SAY ":" OF oDlg PIXEL
@ 45,200 COMBOBOX oCbx VAR v_co_cocmbo ITEMS aBase(1,"cust",256,"cu_coun");
SIZE 110,80 ;
OF oDlg PIXEL
@ 60,2 SAY "&City" OF oDlg PIXEL
@ 60,50 SAY ":" OF oDlg PIXEL
@ 60,200 COMBOBOX oCbx2 VAR v_ci_cocmbo ITEMS aBase(1,"cust",256,"cu_city") size 110,80 ;
OF oDlg PIXEL;
VALID (reset( v_ci_cocmbo, oCbx2, "cust",1,"cu_city","cu_coun" ), .t.)
@ 75,2 SAY "&Governer" OF oDlg PIXEL
@ 75,50 SAY ":" OF oDlg PIXEL
@ 75,200 COMBOBOX oCbx3 VAR v_go_cocmbo ITEMS aBase(1,"cust",256,"cu_gove") size 110,80 ;
OF oDlg PIXEL;
VALID (reset( v_go_cocmbo, oCbx3, "cust",1,"cu_gove","cu_city" ), .t.)
FUNCTION aBase(workarea,dbf_na,arr_size,fld_na)
//-------------------------------------
LOCAL arr:={},nAreaActiv:=Select()
LOCAL y:=0
local bFilter:=""
aAdd(arr,space(arr_size)) //Put First element empty
select (workarea)
use (dbf_na)
SELE (dbf_na)
DBGOTOP()
WHILE!Eof()
y:=ASCAN(arr,(dbf_na)->&fld_na)
if y==0
aAdd(arr,(dbf_na)->&fld_na)
dbSkip()
else
dbSkip()
endif
ENDDO
SELE (nAreaActiv)
RETURN(arr)
function reset( cItem, oCbx, cFile ,workarea,fld_na,filtered_fld)
//--------------------------------------------------------------
local aItems:={}
local nArea:= select()
local y:=0
select (workarea)
use (cFile)
set filter to cItem == (workarea)->filtered_fld
go top
do while ! eof()
y:=ASCAN(aItems,(cFile)->&fld_na)
if y==0
aAdd(aItems,(cFile)->&fld_na)
dbSkip()
else
dbSkip()
endif
enddo
use
select( nArea )
oCbx:setItems( aItems )
oCbx:refresh()
return nil[/code:1zmyem54] |
filtering combo box according to entered variable | Please explain what you mean when you say "it does not work." What, exactly is the problem?
I suggest a different approach than scanning the array for each record. If you index the file by the field being searched with the UNIQUE clause, then it will be much faster than scanning the array.
Ah, I just spotted a problem. You have the VALIDs on the wrong controls. You want the next control to be reset when the current control is exited (thus the VALID). So the first VALID resets the next control, and the second VALID resets the last control. They should be like this:
[code:17jzfavv]@ 45,2 SAY "&Country" OF oDlg PIXEL
@ 45,50 SAY ":" OF oDlg PIXEL
@ 45,200 COMBOBOX oCbx VAR v_co_cocmbo ITEMS aBase(1,"cust",256,"cu_coun");
SIZE 110,80 ;
OF oDlg PIXEL ;
VALID (reset( v_co_cocmbo, oCbx2, "cust",1,"cu_city","cu_coun" ), .t.)
@ 60,2 SAY "&City" OF oDlg PIXEL
@ 60,50 SAY ":" OF oDlg PIXEL
@ 60,200 COMBOBOX oCbx2 VAR v_ci_cocmbo ITEMS aBase(1,"cust",256,"cu_city") size 110,80 ;
OF oDlg PIXEL;
VALID (reset( v_ci_cocmbo, oCbx3, "cust",1,"cu_gove","cu_city" ), .t.)
@ 75,2 SAY "&Governer" OF oDlg PIXEL
@ 75,50 SAY ":" OF oDlg PIXEL
@ 75,200 COMBOBOX oCbx3 VAR v_go_cocmbo ITEMS aBase(1,"cust",256,"cu_gove") size 110,80 ;
OF oDlg PIXEL[/code:17jzfavv]
There is also another problem. What if the user does all three selections, then goes back to the first, or second, and makes a change. All the following controls need to be reset to blank. Also, what if the user makes the country selection then tries to make a governor selection? Is the last combobox empty?
Here is another issue. What if the database is incomplete? When there are no records in the file, then there is nothing to choose from. I think you would have to keep the choices separate from the customer database. How is the user going to enter something that is not yet in the database?
All things to think about...
James |
filtering combo box according to entered variable | Also, there is no need to pass a workarea. Select(0) gets you the next available workarea. Hardcoding workareas is something to be avoided. It is possible--I never do it.
James |
filtering combo box according to entered variable | "It does not work " Oka the country combobox have no problem . the city appeared for seconds and disappeared also the governers disappeared immediately . select (0) got error message no workarea.
Here down the code I used :
[code:1rtmskzl]
@ 45,2 SAY "&Country" OF oDlg PIXEL
@ 45,50 SAY ":" OF oDlg PIXEL
@ 45,200 COMBOBOX oCbx VAR v_co_cocmbo ITEMS aBase(1,"cust",256,"cu_coun");
SIZE 110,80 ;
OF oDlg PIXEL ;
VALID (reset( v_co_cocmbo, oCbx2, "cust","cu_city","cu_coun" ), .t.)
@ 60,2 SAY "&City" OF oDlg PIXEL
@ 60,50 SAY ":" OF oDlg PIXEL
@ 60,200 COMBOBOX oCbx2 VAR v_ci_cocmbo ITEMS aBase(1,"cust",256,"cu_city") size 110,80 ;
OF oDlg PIXEL;
VALID (reset( v_ci_cocmbo, oCbx3, "cust","cu_gove","cu_city" ), .t.)
@ 75,2 SAY "&Governer" OF oDlg PIXEL
@ 75,50 SAY ":" OF oDlg PIXEL
@ 75,200 COMBOBOX oCbx3 VAR v_go_cocmbo ITEMS aBase(1,"cust",256,"cu_gove") size 110,80 ;
OF oDlg PIXEL
function reset( cItem,oCbx,cFile,fld_na,filter_name)
//---------------------------------------------------------
local aItems:={}
local nArea:= select()
local y:=0
*select (0)
use (cFile) new
set filter to cItem == filter_name
go top
do while ! eof()
y:=ASCAN(aItems,(cFile)->&fld_na)
if y==0
aAdd(aItems,(cFile)->&fld_na)
dbSkip()
else
dbSkip()
endif
ENDDO
use
select( nArea )
oCbx:setItems( aItems )
oCbx:refresh()
return nil
[/code:1rtmskzl] |
filtering output to Excel | I am trying to filter DBF to get variable data into excel sheet . I built my filter fine but I got Harbour Exception error .
[code:1xgg2jb9]
function executexcel(oCombo1,oCombo2,oCombo3,oCombo4,oCombo5,oCombo6,oCombo7,oCombo8,oCombo9,oCombo10)
*--------------------------------------------------------------------------------------------------------
LOCAL cPath := "E:\programs\clipper\fwh\sitex\test.XLS"
local oExcel , oBook, oSheet
LOCAL nline:=5
local ncol
local nCounter:=1
local nStart := nCounter
local cMemo := ''
local a2_fields[12]
local a2_vars[12]
local cFilter:=""
local cValue:=""
local i:=0
select 4
use mete
index on mete->ME_mc_serl to mete
index on str(mete->year) + str(mete->month) to mete1
index on mete->me_date to mete2
a2_fields[1]:="(4)->Me_CU_ACCt"
a2_fields[2]:="(4)->Me_CU_name"
a2_fields[3]:="(4)->Me_CT_CTNA"
a2_fields[4]:="(4)->Me_mc_type"
a2_fields[5]:="(4)->Me_mc_modl"
a2_fields[6]:="(4)->Me_mc_serl"
a2_fields[7]:="(4)->Me_mc_brn"
a2_fields[8]:="(4)->Me_mc_mere"
a2_fields[9]:="(4)->Me_mc_dep"
a2_fields[10]:="(4)->Me_mc_loc"
a2_fields[11]:="(4)->Me_date"
a2_fields[12]:="(4)->Me_date"
a2_vars[1]:=oCombo1
a2_vars[2]:=oCombo2
a2_vars[3]:=oCombo3
a2_vars[4]:=oCombo4
a2_vars[5]:=oCombo5
a2_vars[6]:=oCombo6
a2_vars[7]:=oCombo7
a2_vars[8]:=oCombo8
a2_vars[9]:=oCombo9
a2_vars[10]:=oCombo10
a2_vars[11]:=ctod("01/06/2006")
a2_vars[12]:=ctod("30/06/2006")
? oCombo1
? oCombo2
? oCombo3
For i := 1 to 12
IF Empty(a2_Vars[i]) && Don't process empty variables
LOOP
ENDIF
DO CASE && Create char value
CASE VALTYPE(a2_vars[i]) == "D" .AND. i==11
cValue:= 'DTOS(' + a2_Fields[i] + ') >= "' + DTOS(a2_Vars[i]) + '"'
CASE VALTYPE(a2_vars[i]) == "D" .AND. i==12
cValue := 'DTOS(' + a2_Fields[i] + ') <= "' + DTOS(a2_Vars[i]) + '"'
CASE VALTYPE(a2_vars[i]) == "N"
cValue := 'STR(' + a2_Fields[i] + ') == "' + STR(a2_vars[i]) + '"' && or
CASE VALTYPE(a2_vars[i]) == "C"
cValue :="alltrim(upper("+ a2_Fields[i]+"))" + '=="' + alltrim(upper(a2_Vars[i])) + '"'
ENDCASE
IF Empty(cFilter) && this is the first element
cFilter := cValue
ELSE
cFilter += " .AND. " + cValue
ENDIF
NEXT
? (cFilter)
OleSetProperty( OleGetProperty( oSheet, "Cells", 3, 1 ), "Value", "branch" )
OleSetProperty( OleGetProperty( oSheet, "Cells", 3, 2 ), "Value", "Type" )
OleSetProperty( OleGetProperty( oSheet, "Cells", 3, 3 ), "Value", "Model" )
OleSetProperty( OleGetProperty( oSheet, "Cells", 3, 4 ), "Value", "Serial" )
OleSetProperty( OleGetProperty( oSheet, "Cells", 3, 5 ), "Value", "Opening" )
OleSetProperty( OleGetProperty( oSheet, "Cells", 3, 6 ), "Value", "closing" )
OleSetProperty( OleGetProperty( oSheet, "Cells", 3, 7 ), "Value", "prints" )
OleSetProperty( OleGetProperty( oSheet, "Cells", 3, 8 ), "Value", "waste" )
select 4
4->(dbgotop())
set filter to &(cFilter)
4->(dbgotop())
DO WHILE !(4)->(EOF())
OleSetProperty( OleGetProperty( oSheet, "Cells", nLine, 1 ), "Value", (4)->me_mc_brn)
OleSetProperty( OleGetProperty( oSheet, "Cells", nLine, 2 ), "Value", (4)->me_mc_type)
OleSetProperty( OleGetProperty( oSheet, "Cells", nLine, 3 ), "Value", (4)->me_mc_modl)
OleSetProperty( OleGetProperty( oSheet, "Cells", nLine, 4 ), "Value", (4)->me_mc_serl)
OleSetProperty( OleGetProperty( oSheet, "Cells", nLine, 5 ), "Value", (4)->open_meter)
OleSetProperty( OleGetProperty( oSheet, "Cells", nLine, 6 ), "Value", (4)->cls_meter)
OleSetProperty( OleGetProperty( oSheet, "Cells", nLine, 7 ), "Value", (4)->prints)
OleSetProperty( OleGetProperty( oSheet, "Cells", nLine, 8 ), "Value", (4)->waste)
nLine:=nLine+1
(4)->(DBSKIP(1))
ENDDO
OleSetProperty( oExcel, "Visible", .t. )
OLEInvoke(oExcel,"Quit")
RETURN NIL
[/code:1xgg2jb9] |
filtering records in xbrowse | [img:18o99ils]http://img121.imageshack.us/img121/33/untitledin2.png[/img:18o99ils]
That first record is deifferent from my filter condition . I am using go top after set filter and I do not know why I can see different record from my filter scope .
[code:18o99ils]
STATIC FUNCTION mete( oWnd )
*--------------------------
local oChild, oBrw
Local oDlgn, oDbfc, oBrwc
local nRecNo := RecNo()
local new_rec := 0
local oGet
local i:=0
local nFor
local bFilter := ""
local cFilter := ""
local x := ""
REQUEST ADS
rddRegister( "ADS", 1 )
rddsetdefault( "ADS" )
AdsSetDeleted(.T.)
SET SERVER LOCAL
SET FILETYPE TO CDX
x := "'9855564'"
cFilter := "me_mc_serl = "+ x
bFilter = "{||"+cFilter+"}"
SELECT 4
use mete
SET index TO mete2
DBSETFILTER(&bFilter,cFilter)
4->(DBGOTOP())
DEFINE DIALOG oDlgn FROM 1,1 TO 50,140 TITLE "Dialog Meter Works"
oBrw := TXBrowse():New( oDlgn )
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:lColDividerComplete := .t.
oBrw:nHeaderLines := 1
oBrw:nFooterLines := 1
oBrw:nDataLines := 1
oBrw:lFooter := .t.
oBrw:SetRDD()
SELECT 4
use mete
SET index TO mete2
DBSETFILTER(&bFilter,cFilter)
4->(DBGOTOP())
oBrw:Refresh(.t.)
for nFor := 1 to Fcount()
*if (nFor<16)
* loop
*endif
if nFor=21
oBrw:aCols[ nFor ]:cHeader := FieldName( nFor )
oBrw:aCols[ nFor ]:cFooter := alltrim(STR(TOTALEM2(),12,0))
loop
endif
*oBrw:aCols[ nFor ]:cHeader := FieldName( nFor )
*oBrw:aCols[ nFor ]:cFooter := FieldName( nFor )
next
@ 18, 1 BUTTON "&New" OF oDlgn SIZE 40, 12 ACTION addmeter( oLbx, .t. )
@ 18, 8 BUTTON "&Modify" OF oDlgn SIZE 40, 12 //ACTION Editmach( oLbx, .f. )
@ 18, 15 BUTTON "&Delete" OF oDlgn SIZE 40, 12 //ACTION Delrecord( oLbx )
@ 18, 22 BUTTON "&Search" OF oDlgn SIZE 40, 12 //ACTION Seekmach( oLbx )
@ 18, 29 BUTTON "&Print" OF oDlgn ;
SIZE 40, 12;
ACTION oBrw:Report( "Machines Report", .t. ) ; // .t. --> wants preview
@ 18, 36 BUTTON "&Exit" OF oDlgn ACTION oDlgn:End() SIZE 40, 12
@ 19, 1 BUTTON "&Order" OF oDlgn SIZE 40, 12 //ACTION ordermach(oLbx)
@ 19, 8 BUTTON "&Filter" OF oDlgn SIZE 40, 12 //ACTION metefilter(oLbx)
@ 19, 15 BUTTON "&Unfilter" OF oDlgn SIZE 40, 12 //ACTION filtermachNotOk(oLbx)
oBrw:CreateFromCode()
return nil
[/code:18o99ils] |
filtering records in xbrowse | [b:3b0w4sn4]Ehab Amir Azis wrote[/b:3b0w4sn4]
[code:3b0w4sn4]
SELECT 4
use mete
SET index TO mete2
DBSETFILTER(&bFilter,cFilter)
4->(DBGOTOP())
[/code:3b0w4sn4]
[b:3b0w4sn4]replace with this[/b:3b0w4sn4]
[code:3b0w4sn4]
bFirst := {|| mete->(DbSeek(cFilter, .t. )) }
bLast := {|| iif(Empty(cFilter), ;
mete->(DbGoBottom()) , ;
(mete->(DbSeek(cFilter+"999",.T.)), ;
meter->(DbSkip(-1)))) }
bWhile := {|| mete->your_fieldname_for_filter == cFilter }
bFor := {|| .T. }
oBrw:bGoTop := {|| TBFwFirst(bFirst, bWhile, bFor) }
oBrw:bGoBottom := {|| TBFwLast(bLast, bWhile, bFor) }
oBrw:bSkip := {|n| TBFwSkip(n, bWhile, bFor) }
[/code:3b0w4sn4]
then add this source to your prg file
[code:3b0w4sn4]
FUNCTION TBFwFirst(bGoFirst, bWhile, bFor)
eval(bGoFirst)
DO WHILE !eof() .AND. eval(bWhile) .AND. !eval(bFor)
SKIP
ENDDO
IF !eval(bWhile)
// no records match filter - could also be at eof already here
GOTO 0
ENDIF
RETURN NIL
FUNCTION TBFwLast(bGoLast, bWhile, bFor)
eval(bGoLast)
DO WHILE !bof() .AND. eval(bWhile) .AND. !eval(bFor)
SKIP -1
ENDDO
IF bof() .OR. !eval(bWhile)
// No records match scope
GOTO 0
ENDIF
RETURN NIL
FUNCTION TBFwSkip(nToSkip, bWhile, bFor)
LOCAL nSkipped := 0, ;
nLastValidRecNum := Recno()
IF nToSkip = 0
SKIP 0
RETURN 0
ENDIF
IF nToSkip > 0
DO WHILE nSkipped < nToSkip .AND. !eof() .AND. eval(bWhile)
SKIP
// Note the last clause here makes a big speed difference
DO WHILE !eval(bFor) .AND. !eof() .AND. eval(bWhile)
SKIP
ENDDO
IF Eval(bWhile) .AND. !eof()
// Found a new record matching the scope
nSkipped++
nLastValidRecNum := Recno()
ENDIF
ENDDO
IF eof() .OR. !eval(bWhile)
GOTO nLastValidRecNum
ENDIF
ELSE
DO WHILE nSkipped > nToSkip .AND. !bof() .AND. eval(bWhile)
SKIP -1
// Note the last clause here makes a big speed difference
DO WHILE !eval(bFor) .AND. !bof() .AND. eval(bWhile)
SKIP -1
ENDDO
IF Eval(bWhile) .AND. !bof()
nSkipped--
nLastValidRecNum := Recno()
ENDIF
ENDDO
IF !eval(bWhile) .OR. bof()
GOTO nLastValidRecNum
ENDIF
ENDIF
RETURN nSkipped
[/code:3b0w4sn4]
Best Regard
areang |
filtering records in xbrowse | I got that error :
Not exported variable
Application
===========
Path and name: E:\programs\clipper\FWH\sitex\sitex.exe (32 bits)
Size: 1,527,808 bytes
Time from start: 0 hours 0 mins 6 secs
Error occurred at: 16/12/2006, 13:09:05
Error description: Error BASE/1005 No exported variable: BGOTOP
Args:
[ 1] = U
[ 2] = B {|| ... }
Stack Calls
===========
Called from: => _BGOTOP(0)
Called from: sitex.prg => METE(4534)
Called from: sitex.prg => (b)BUILDMENU(164)
Called from: => TMENU:COMMAND(0)
Called from: => TWINDOW:COMMAND(0)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: => TWINDOW:ACTIVATE(0)
Called from: sitex.prg => MAIN(137)
[code:3pz70enp]
STATIC FUNCTION mete( oWnd )
*--------------------------
local oChild, oBrw
Local oDlgn, oDbfc, oBrwc
local nRecNo := RecNo()
local new_rec := 0
local oGet
local i:=0
local nFor
local bFilter := ""
local cFilter := ""
local x := ""
local bFirst,bLast,bWhile,bFor,bGoTop,bGoBottom,bSkip
REQUEST ADS
rddRegister( "ADS", 1 )
rddsetdefault( "ADS" )
AdsSetDeleted(.T.)
SET SERVER LOCAL
SET FILETYPE TO CDX
x := "'9855564'"
cFilter := "me_mc_serl = "+ x
bFilter = "{||"+cFilter+"}"
SELECT 4
use mete
SET index TO mete2
bFirst := {|| mete->(DbSeek(cFilter, .t. )) }
bLast := {|| iif(Empty(cFilter), ;
mete->(DbGoBottom()) , ;
(mete->(DbSeek(cFilter+"999",.T.)), ;
mete->(DbSkip(-1)))) }
bWhile := {|| mete->me_mc_serl == cFilter }
bFor := {|| .T. }
oBrw:bGoTop := {|| TBFwFirst(bFirst, bWhile, bFor) }
oBrw:bGoBottom := {|| TBFwLast(bLast, bWhile, bFor) }
oBrw:bSkip := {|n| TBFwSkip(n, bWhile, bFor) }
DEFINE DIALOG oDlgn FROM 1,1 TO 50,140 TITLE "Dialog Meter Works"
oBrw := TXBrowse():New( oDlgn )
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:lColDividerComplete := .t.
oBrw:nHeaderLines := 1
oBrw:nFooterLines := 1
oBrw:nDataLines := 1
oBrw:lFooter := .t.
oBrw:SetRDD()
oBrw:Refresh(.t.)
for nFor := 1 to Fcount()
*if (nFor<16)
* loop
*endif
if nFor=21
oBrw:aCols[ nFor ]:cHeader := FieldName( nFor )
oBrw:aCols[ nFor ]:cFooter := alltrim(STR(TOTALEM2(),12,0))
loop
endif
*oBrw:aCols[ nFor ]:cHeader := FieldName( nFor )
*oBrw:aCols[ nFor ]:cFooter := FieldName( nFor )
next
@ 18, 1 BUTTON "&New" OF oDlgn SIZE 40, 12 //ACTION addmeter( oLbx, .t. )
@ 18, 8 BUTTON "&Modify" OF oDlgn SIZE 40, 12 //ACTION Editmach( oLbx, .f. )
@ 18, 15 BUTTON "&Delete" OF oDlgn SIZE 40, 12 //ACTION Delrecord( oLbx )
@ 18, 22 BUTTON "&Search" OF oDlgn SIZE 40, 12 //ACTION Seekmach( oLbx )
@ 18, 29 BUTTON "&Print" OF oDlgn ;
SIZE 40, 12;
ACTION oBrw:Report( "Machines Report", .t. ) ; // .t. --> wants preview
@ 18, 36 BUTTON "&Exit" OF oDlgn ACTION oDlgn:End() SIZE 40, 12
@ 19, 1 BUTTON "&Order" OF oDlgn SIZE 40, 12 //ACTION ordermach(oLbx)
@ 19, 8 BUTTON "&Filter" OF oDlgn SIZE 40, 12 //ACTION metefilter(oLbx)
@ 19, 15 BUTTON "&Unfilter" OF oDlgn SIZE 40, 12 //ACTION filtermachNotOk(oLbx)
oBrw:CreateFromCode()
return nil
[/code:3pz70enp] |
filtering using set scope..pls help | I need to adjust the program below to be used with set scope instead of set filter .
[code:1txty6p6]
STATIC FUNCTION mete( oWnd )
*--------------------------
local oChild, oBrw
local nFor
local bFilter := ""
local cFilter := ""
local x := ""
REQUEST ADS
rddRegister( "ADS", 1 )
rddsetdefault( "ADS" )
AdsSetDeleted(.T.)
SET SERVER LOCAL
SET FILETYPE TO CDX
select 4
USE METE
x := "'9855564'"
cFilter := "me_mc_serl = "+ x
bFilter = "{||"+cFilter+"}"
DBSETFILTER(bFilter,cFilter)
DBGOTOP()
DEFINE WINDOW oChild FROM 4, 4 TO 25, 75 ;
TITLE "Meter Works"
oBrw := TXBrowse():New( oChild )
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:lColDividerComplete := .t.
oBrw:nHeaderLines := 1
oBrw:nFooterLines := 1
oBrw:nDataLines := 2
oBrw:lFooter := .t.
oBrw:SetRDD()
for nFor := 1 to Fcount()
if nFor=20
oBrw:aCols[ nFor ]:cHeader := FieldName( nFor )
oBrw:aCols[ nFor ]:cFooter := alltrim(STR(TOTALEM2(),12,0))
loop
endif
oBrw:aCols[ nFor ]:cHeader := FieldName( nFor )
oBrw:aCols[ nFor ]:cFooter := FieldName( nFor )
next
oBrw:CreateFromCode()
oChild:oClient := oBrw
ACTIVATE WINDOW oChild MAXIMIZED ON INIT oBrw:SetFocus()
RETURN NIL
[/code:1txty6p6] |
filtering using set scope..pls help | cFilter := "me_mc_serl = "+ x
bFilter = "{||"+cFilter+"}"
DBSETFILTER(bFilter,cFilter)
bFilter isn't a codeblock , macro expansion ?????????????
Frank |
filtering using set scope..pls help | believe me was macro also filter does not work with RDD server . pls if you know the syntax of set scope tell me ? |
filtering using set scope..pls help | DBSETFILTER (&bFilter,cFilter)..... you forgot the "&" in the macro expression |
filtrar mysql .. xbrowse... tdolphin.. no refresca | Estimados, tengo el siguiente problema con un programa, hago una consulta, de inicio, que se refleja en un xbrowse, tal como esta.
cTab_Art:=xServer:Query("SELECT a.*, b.*, c.* FROM tab_art AS a LEFT JOIN tab_fam AS b ON a.fam_art = b.cod_fam LEFT JOIN tab_mar AS c ON a.mar_art = c.cod_mar ORDER BY cod_art ")
y me muestra bien mis datos.., pero cuando hago la siguiente consultas con estos filtros, ya sea por familia, sin marca.... con marca.. sin familia... o escogiendo uno y otro.. le doy la nueva consulta.. lo que me retorna en el browse es un mismo item repetido en todo el xbrowse... alguien me puede indicar en que estoy fallando...
oBrw es el objeto del xbrowse
cCod_Fam.. traigo campo familia en 3 caracteres..
cCod_Mar.. traigo campo marca en 4 caracteres
cTab_Art.. es el objeto que se hace la consulta
FUNCTION Filtrar_Producto1(oBrw,cCod_Fam,cCod_Mar,cTab_Art)
Do Case
case cCod_Fam="000" .and. cCod_Mar="0000"
cTab_Art:=xServer:Query("SELECT a.*, b.*, c.* FROM tab_art AS a LEFT JOIN tab_fam AS b ON a.fam_art = b.cod_fam LEFT JOIN tab_mar AS c ON a.mar_art = c.cod_mar ORDER BY cod_art ")
SetDolphin( oBrw, cTab_Art,.f. )
cTab_Art:Refresh()
oBrw:SetFocus()
oBrw:Refresh()
case cCod_Fam#"000" .and. cCod_Mar="0000"
msgInfo(cCod_Fam)
cTab_Art:=xServer:Query("SELECT a.*, b.*, c.* FROM tab_art AS a LEFT JOIN tab_fam AS b ON a.fam_art = b.cod_fam LEFT JOIN tab_mar AS c ON a.mar_art = c.cod_mar WHERE a.fam_art='"+cCod_Fam+"' ORDER BY cod_art ")
SetDolphin( oBrw, cTab_Art,.f. )
cTab_Art:Refresh()
oBrw:SetFocus()
oBrw:Refresh()
case cCod_Fam="000" .and. cCod_Mar#"0000"
msgInfo(cCod_Mar)
cTab_Art:=xServer:Query("SELECT a.*, b.*, c.* FROM tab_art AS a LEFT JOIN tab_fam AS b ON a.fam_art = b.cod_fam LEFT JOIN tab_mar AS c ON a.mar_art = c.cod_mar WHERE a.mar_art='"+cCod_Mar+"' ORDER BY cod_art ")
SetDolphin( oBrw, cTab_Art,.f. )
cTab_Art:Refresh()
oBrw:SetFocus()
oBrw:Refresh()
case cCod_Fam#"000" .and. cCod_Mar#"0000"
msgInfo(cCod_Fam+" "+cCod_Mar)
cTab_Art:=xServer:Query("SELECT a.*, b.*, c.* FROM tab_art AS a LEFT JOIN tab_fam AS b ON a.fam_art = b.cod_fam LEFT JOIN tab_mar AS c ON a.mar_art = c.cod_mar WHERE a.fam_art='"+cCod_Fam+"' and a.mar_art='"+cCod_Mar+"' ORDER BY cod_art ")
SetDolphin( oBrw, cTab_Art,.f. )
cTab_Art:Refresh()
oBrw:SetFocus()
oBrw:Refresh()
EndCase
RETURN .t. |
filtrar mysql .. xbrowse... tdolphin.. no refresca | Prueba solo cambiando el where con el metodo SetNewFilter de Tdolphin...
[code=fw:95gn5osk]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">Do</span> <span style="color: #00C800;">Case</span><br /> <span style="color: #00C800;">case</span> cCod_Fam=<span style="color: #ff0000;">"000"</span> .and. cCod_Mar=<span style="color: #ff0000;">"0000"</span><br /> cWhere:= <span style="color: #ff0000;">" TRUE "</span><br /> <span style="color: #00C800;">case</span> cCod_Fam#<span style="color: #ff0000;">"000"</span> .and. cCod_Mar=<span style="color: #ff0000;">"0000"</span><br /> cWhere := <span style="color: #ff0000;">" a.fam_art='"</span>+cCod_Fam<br /> <span style="color: #00C800;">case</span> cCod_Fam=<span style="color: #ff0000;">"000"</span> .and. cCod_Mar#<span style="color: #ff0000;">"0000"</span><br /> cWhere := <span style="color: #ff0000;">" a.mar_art='"</span>+cCod_Mar<br /> <span style="color: #00C800;">case</span> cCod_Fam#<span style="color: #ff0000;">"000"</span> .and. cCod_Mar#<span style="color: #ff0000;">"0000"</span><br /> cWhere :=<span style="color: #ff0000;">"a.fam_art='"</span>+cCod_Fam+<span style="color: #ff0000;">"' and a.mar_art='"</span>+cCod_Mar+<span style="color: #ff0000;">"' ORDER BY cod_art "</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">EndCase</span> <br />cTab_Art:<span style="color: #000000;">SetNewFilter</span><span style="color: #000000;">(</span>SET_WHERE,cWhere,.t.<span style="color: #000000;">)</span><br />oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span></div>[/code:95gn5osk] |
filtrar mysql .. xbrowse... tdolphin.. no refresca | Estimado, te agradezco el apoyo, ingrese tu código y me arroja esto..
Time from start: 0 hours 0 mins 25 secs
Error occurred at: 05/07/2018, 15:53:11
Error description: Error MYSQL/1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY a.cod_art' at line 1
no importa como lo escriba.. igual me arroja error.
Consulta... leí por ahí información de Mr. Rao., de su trabajo... alguien tiene por algún lado un manual o referencia rápida.. de todos los alcances que uno puede encontrar con xbrowse... hay tanto que quisiera saber y probar..
tal como.. super header.., bloquear que se haga click sobre una columna, con lo que impido que pasen eventos o se orden y quizas cuanta otra cosa mas hay para ver y aprender.
Atte |
filtrar mysql .. xbrowse... tdolphin.. no refresca | Si, perdon, quita el ORDER BY de la ultima opcion y prueba si te lo filtra
[code=fw:35udmgzs]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">Do</span> <span style="color: #00C800;">Case</span><br /> <span style="color: #00C800;">case</span> cCod_Fam=<span style="color: #ff0000;">"000"</span> .and. cCod_Mar=<span style="color: #ff0000;">"0000"</span><br /> cWhere:= <span style="color: #ff0000;">" TRUE "</span><br /> <span style="color: #00C800;">case</span> cCod_Fam#<span style="color: #ff0000;">"000"</span> .and. cCod_Mar=<span style="color: #ff0000;">"0000"</span><br /> cWhere := <span style="color: #ff0000;">" a.fam_art='"</span>+cCod_Fam<br /> <span style="color: #00C800;">case</span> cCod_Fam=<span style="color: #ff0000;">"000"</span> .and. cCod_Mar#<span style="color: #ff0000;">"0000"</span><br /> cWhere := <span style="color: #ff0000;">" a.mar_art='"</span>+cCod_Mar<br /> <span style="color: #00C800;">case</span> cCod_Fam#<span style="color: #ff0000;">"000"</span> .and. cCod_Mar#<span style="color: #ff0000;">"0000"</span><br /> cWhere :=<span style="color: #ff0000;">"a.fam_art='"</span>+cCod_Fam+<span style="color: #ff0000;">"' and a.mar_art='"</span>+cCod_Mar<span style="color: #000000;">)</span><br /><span style="color: #00C800;">EndCase</span> <br />cTab_Art:<span style="color: #000000;">SetNewFilter</span><span style="color: #000000;">(</span>SET_WHERE,cWhere,.t.<span style="color: #000000;">)</span><br /><span style="color: #00C800;">if</span> cCod_Fam#<span style="color: #ff0000;">"000"</span> .and. cCod_Mar#<span style="color: #ff0000;">"0000"</span> <br /> cTab_Art:<span style="color: #000000;">SetOrder</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"cod_art"</span>,.T.<span style="color: #000000;">)</span><br /><span style="color: #00C800;">endif</span><br />oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> </div>[/code:35udmgzs]
Como manual de consulta no hay nada mejor que buscar en el codigo fuente del programa
fivewin\source\classes\xbrowse.prg |
filtrar un xbrowse | Hola tengo el siguiente problema en un folder tengo que editar en dos pestañas (en total son tres) distintas de una misma base de datos pero en uno sin restricciones y en la otra solamente las que tengan un determinado campo vacío.
Esto estaba funcionando perfectamente en wbrose (solamente dos pestañas que interactúan entre ellas), pero ante la necesidad de hacer lo antedicho, lo pase a xbrowse pensando que quizás sea más fácil, los ejemplos que ví en el foro es necesario indexar la base de datos sobre ese campo para poder usarlo. EJ
REDEFINE XBROWSE oBrw1 ID 103 OF oFold:adialogs[ 1 ] DATASOURCE oPedido;
COLUMNS { 1, 2, 3, 4, 5 };
HEADERS "Nº", "Proveedor", "Código", "Fecha", "Entrega";
COLSIZES 50, 180, 90, 90, 90;
SELECT oPedido:DJAIESTA FOR ""
LINES CELL UPDATE ON DBLCLICK agregar( .F., oProex )
Realmente no lo probé, pero hay alguna forma de usarlo sin tener que indexar.
Una de las formas que se me ocurre es abrir dos veces la base de datos y en una de ellas es filtrar por ese campo.
Quizás haya alguna forma de hacerlo de otra forma
Gracias por su atención |
filtrar un xbrowse | [code=fw:rgmnc9h0]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">SELECT</span> oPedido:<span style="color: #000000;">DJAIESTA</span> <span style="color: #00C800;">FOR</span> <span style="color: #ff0000;">""</span></div>[/code:rgmnc9h0]
works in wbrowse but does not work in xbrowse.
We need to set Filter or Scope on the Alias as we need.
[code=fw:rgmnc9h0]<div class="fw" id="{CB}" style="font-family: monospace;">COLUMNS <span style="color: #000000;">{</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">2</span>, <span style="color: #000000;">3</span>, <span style="color: #000000;">4</span>, <span style="color: #000000;">5</span> <span style="color: #000000;">}</span></div>[/code:rgmnc9h0]
It is desirable that field names are used instead of numbers. |
filtrar una tabla por un campo.... | Hola a todos queria saber si estoy haciendo bien un set filter en una tabla, este es parte del código que utilizo..
1-----SET FILTER TO (ariculos->codigo == clientes->codcli)
2-----articulos->(RECNO())
3-----odlg:REFRESH()
4-----registros()
La linea 1 es donde pretendo realizar el filtrado,la 2 coloco el recno en el registro de los articulos (quiero mantener el mismo cliente y mostrar todos los articulos que este tiene), la 3 es para refrescar la pantalla cada vez que realizo una busqueda nueva y la 4 es para irme al recurso donde muestro los campos (es una function donde tengo declarado los campos a mostrar).
Si ejecuto esto no me da error y me muestra la informacion del cliente (que viene de otro lado) pero no me muestra los articulos que tiene, sólo me muestra el primer articulo de la tabla y no cambia....
Pueden ayudarme ....
Gracias a todos
Saludos...
Elías Torres. |
filtrar una tabla por un campo.... | Ya lo he solucionado...
Lo que tenia no era del todo correcto, lo modifiqué y puse esto
SET FILTER TO (articulos->codigo==clientes->codcli)
articulos->(DBGOTOP())
odlg:REFRESH()
y ademas lo metí directamente en la funcion registros()
Saludos...
Elías Torres |
filtro en mysq con tdolphin | Estimados, favor de orientar... tengo una tabla con un campo numero de recepción, que es numérico, cuando hago una consulta y lo quiero filtrar..
me muestra todos los registros.. no me respeta la condición del filtro, favor de indicarme que puedo estar haciendo mal.
Mensaje:="Recepciones Periodo.. : "+Transform(cFolio1,"999999")+" al "+Transform(cFolio2,"999999")
cExt_Rec1:=xServer:Query("SELECT a.*, b.* FROM ext_rec1 AS a LEFT JOIN tab_cte AS b ON b.rut_cte = a.rut_cte WHERE a.nro_rec >='"+Alltrim(Str(cFolio1))+"' and a.nro_rec<='"+Alltrim(Str(cFolio2))+"' ORDER BY a.nro_rec") |
filtro en mysq con tdolphin | Prueba sin las comillas en estas expresiones
[code=fw:1k1qjuyb]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #ff0000;">'"+Alltrim(Str(cFolio1))+"'</span><br /> </div>[/code:1k1qjuyb]
asi
[code=fw:1k1qjuyb]<div class="fw" id="{CB}" style="font-family: monospace;"><br />+Alltrim<span style="color: #000000;">(</span>Str<span style="color: #000000;">(</span>cFolio1<span style="color: #000000;">)</span><span style="color: #000000;">)</span>+<br /> </div>[/code:1k1qjuyb] |
filtro en mysq con tdolphin | Mi estimado, saque las comillas y me arrojo error de sintaxis, comando no valido en Mysql.... |
filtro en mysq con tdolphin | Mi estimado, gracias, hice un cambio y funciono bien... error de sintaxis.. pero de quien escribe... si no me dices.. no veo mi error... muchas gracias |
filtro en mysq con tdolphin | Saludos, un codigo limpio y ordenado puede ayudar a resolver mas rapido un error, pero cada quien tiene su estilo...te recomiendo que intentes asi...saludos... <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: -->
[code=fw:25hfwhej]<div class="fw" id="{CB}" style="font-family: monospace;"><br />cSql := <span style="color: #ff0000;">"SELECT a.*, b.* "</span><br /><br />cSql += <span style="color: #ff0000;">"FROM ext_rec1 AS a "</span><br /><br />cSql += <span style="color: #ff0000;">"LEFT JOIN tab_cte AS b ON b.rut_cte = a.rut_cte "</span><br /><br />cSql += <span style="color: #ff0000;">"WHERE a.nro_rec >= '"</span> + Alltrim<span style="color: #000000;">(</span>Str<span style="color: #000000;">(</span>cFolio1<span style="color: #000000;">)</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"' "</span><br />cSql += <span style="color: #ff0000;">"AND a.nro_rec <= '"</span> + Alltrim<span style="color: #000000;">(</span>Str<span style="color: #000000;">(</span>cFolio2<span style="color: #000000;">)</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"' "</span><br /><br />cSql += <span style="color: #ff0000;">"ORDER BY a.nro_rec"</span><br /><br />cExt_Rec1 := xServer:<span style="color: #000000;">Query</span><span style="color: #000000;">(</span>cSql<span style="color: #000000;">)</span><br /> </div>[/code:25hfwhej] |
filtro en mysq con tdolphin | [quote="joseluisysturiz":2firr4pp]Saludos, un codigo limpio y ordenado puede ayudar a resolver mas rapido un error, pero cada quien tiene su estilo...te recomiendo que intentes asi...saludos... <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: -->
[code=fw:2firr4pp]<div class="fw" id="{CB}" style="font-family: monospace;"><br />cSql := <span style="color: #ff0000;">"SELECT a.*, b.* "</span><br /><br />cSql += <span style="color: #ff0000;">"FROM ext_rec1 AS a "</span><br /><br />cSql += <span style="color: #ff0000;">"LEFT JOIN tab_cte AS b ON b.rut_cte = a.rut_cte "</span><br /><br />cSql += <span style="color: #ff0000;">"WHERE a.nro_rec >= '"</span> + Alltrim<span style="color: #000000;">(</span>Str<span style="color: #000000;">(</span>cFolio1<span style="color: #000000;">)</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"' "</span><br />cSql += <span style="color: #ff0000;">"AND a.nro_rec <= '"</span> + Alltrim<span style="color: #000000;">(</span>Str<span style="color: #000000;">(</span>cFolio2<span style="color: #000000;">)</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"' "</span><br /><br />cSql += <span style="color: #ff0000;">"ORDER BY a.nro_rec"</span><br /><br />cExt_Rec1 := xServer:<span style="color: #000000;">Query</span><span style="color: #000000;">(</span>cSql<span style="color: #000000;">)</span><br /> </div>[/code:2firr4pp][/quote:2firr4pp]
Que comentario fuera de lugar.
Saludos |
filtro en mysq con tdolphin | [quote="Compuin":o2plsukl][quote="joseluisysturiz":o2plsukl]Saludos, un codigo limpio y ordenado puede ayudar a resolver mas rapido un error, pero cada quien tiene su estilo...te recomiendo que intentes asi...saludos... <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: -->
[code=fw:o2plsukl]<div class="fw" id="{CB}" style="font-family: monospace;"><br />cSql := <span style="color: #ff0000;">"SELECT a.*, b.* "</span><br /><br />cSql += <span style="color: #ff0000;">"FROM ext_rec1 AS a "</span><br /><br />cSql += <span style="color: #ff0000;">"LEFT JOIN tab_cte AS b ON b.rut_cte = a.rut_cte "</span><br /><br />cSql += <span style="color: #ff0000;">"WHERE a.nro_rec >= '"</span> + Alltrim<span style="color: #000000;">(</span>Str<span style="color: #000000;">(</span>cFolio1<span style="color: #000000;">)</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"' "</span><br />cSql += <span style="color: #ff0000;">"AND a.nro_rec <= '"</span> + Alltrim<span style="color: #000000;">(</span>Str<span style="color: #000000;">(</span>cFolio2<span style="color: #000000;">)</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"' "</span><br /><br />cSql += <span style="color: #ff0000;">"ORDER BY a.nro_rec"</span><br /><br />cExt_Rec1 := xServer:<span style="color: #000000;">Query</span><span style="color: #000000;">(</span>cSql<span style="color: #000000;">)</span><br /> </div>[/code:o2plsukl][/quote:o2plsukl]
Que comentario fuera de lugar.
Saludos[/quote:o2plsukl]
Compuin....leistes y entendistes lo que pregunta el colega y analizastes el porque de mi respuesta o solucion propuesta o solo dijstes algo por decir..? porque consideras fuera de lugar mi comentario.? es solo una recomendacion o mi punto de vista que me ha ayudado y lo comparto, saludos...gracias... <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: --> |
filtro en mysq con tdolphin | [quote="kpidata":2jqiqoje]Mi estimado, gracias, hice un cambio y funciono bien... error de sintaxis.. pero de quien escribe... si no me dices.. no veo mi error... muchas gracias[/quote:2jqiqoje]
Saludos
prodrias mirar los ejemplos
testqry4.prg
y
teststm.prg
dentro de dolphin y la forma de como usar variables dentro de las sentencias, te olvidas de hacer las concatenaciones de strings |
filtro entre fechas | Colegas, trabajo con Mysql y necesitaría hacer una consulta de la siguiente manera:
Registro
[code=fw:37c4fv0h]<div class="fw" id="{CB}" style="font-family: monospace;"><br />desde = <span style="color: #ff0000;">"20/05/2019"</span>, hasta = <span style="color: #ff0000;">"27/05/2019"</span><br /> </div>[/code:37c4fv0h]
condición consulta
[code=fw:37c4fv0h]<div class="fw" id="{CB}" style="font-family: monospace;"><br />desde1 -> <span style="color: #ff0000;">"23/05/2019"</span>, hasta1 -> <span style="color: #ff0000;">"25/05/2019"</span> <br /> </div>[/code:37c4fv0h]
necesitaría que el registro aparezca en la consulta ya que los datos de la condición está contenida en el registro. Si la condición fuera "desde >= desde1 and hasta <= hasta1" ese registro quedaría excluido. Alguien sabe como hacerlo? espero se haya entendido y desde ya muchas gracias
Saludos |
filtro entre fechas | Horacio:
Recuerda que MySQL maneja todo en tipo string, por lo tanto, si entendí, creo que deberías hacerlo así:
[code=fw:7boqckyi]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">LOCAL</span> desde := DTOS<span style="color: #000000;">(</span>FechaInicial<span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> hasta := DTOS<span style="color: #000000;">(</span>FechaFinal<span style="color: #000000;">)</span><br /><br />desde1 => desde .AND. hasta1 <= hasta<br /> </div>[/code:7boqckyi]
Saludos |
filtro entre fechas | Gracias por tu respuesta Armando. eso lo sé. Me parece que no se entiende lo que quise consultar. Quiero hacer una consulta en una tabla cuyos campos entre otros se encuentran "desde" y "hasta", quiero filtrarlos de acuerdo a esos campos. Supongamos que tengo un registro en la tabla con estos datos
[code=fw:3uh99up1]<div class="fw" id="{CB}" style="font-family: monospace;"><br />desde = <span style="color: #ff0000;">'2019-05-24'</span> y hasta = <span style="color: #ff0000;">'2019-05-27'</span><br /> </div>[/code:3uh99up1]
y quiero filtrar esa consulta con estas fechas: fechaDesde -> '2019-05-25' y fechaHasta -> '2019-05-26', quiero que la consulta me devuelva el registro antes mencionado ya que la fecha de los filtros está contenida en el intervalo de las fechas del registro. Espero se entienda
Saludos |
filtro entre fechas | [quote="horacio":2j250170]Gracias por tu respuesta Armando. eso lo sé. Me parece que no se entiende lo que quise consultar. Quiero hacer una consulta en una tabla cuyos campos entre otros se encuentran "desde" y "hasta", quiero filtrarlos de acuerdo a esos campos. Supongamos que tengo un registro en la tabla con estos datos
[code=fw:2j250170]<div class="fw" id="{CB}" style="font-family: monospace;"><br />desde = <span style="color: #ff0000;">'2019-05-24'</span> y hasta = <span style="color: #ff0000;">'2019-05-27'</span><br /> </div>[/code:2j250170]
y quiero filtrar esa consulta con estas fechas: fechaDesde -> '2019-05-25' y fechaHasta -> '2019-05-26', quiero que la consulta me devuelva el registro antes mencionado ya que la fecha de los filtros está contenida en el intervalo de las fechas del registro. Espero se entienda
Saludos[/quote:2j250170]
Usa BETWEEN, saludos... <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: -->
WHERE campo_fch BETWEEN fch_desde AND fch_hasta
[code=fw:2j250170]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">SELECT</span> column_name<span style="color: #000000;">(</span>s<span style="color: #000000;">)</span><br /><span style="color: #0000ff;">FROM</span> table_name<br /><span style="color: #0000ff;">WHERE</span> column_name BETWEEN value1 AND value2<br /> </div>[/code:2j250170] |
filtro entre fechas | Horacio:
Creo ya entendí tu pregunta, son dos campos de tipo fecha que están en el mismo registro, cierto?
Entonces la consulta debe funcionarte:
desde = "20190524" .AND. hasta = "20190527"
A ver si le atine <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
Saludos |
filtro entre fechas | Gracias José por tu sugerencia, he visto con un solo campo de fecha, como sería con dos ? Desde ya muchas gracias.
Saludos |
filtro entre fechas | [quote="horacio":16j5lm4b]Gracias José por tu sugerencia, he visto con un solo campo de fecha, como sería con dos ? Desde ya muchas gracias.
Saludos[/quote:16j5lm4b]
Si vas usar 2 campos de fechas para tomar 2 rangos de fechas metes entre parentesis las validaciones, te lo coloco para que lo pruebes, ya que nunca he necesitado usar 2 fechas entre rangos, pero la logica seria algo asi...saludos... <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: -->
[code=fw:16j5lm4b]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">SELECT</span> column_name<span style="color: #000000;">(</span>s<span style="color: #000000;">)</span><br /><span style="color: #0000ff;">FROM</span> table_name<br /><span style="color: #0000ff;">WHERE</span> <span style="color: #000000;">(</span> column_name1 BETWEEN value1 AND value2 <span style="color: #000000;">)</span> AND/OR <span style="color: #000000;">(</span> column_name2 BETWEEN value1 AND value2 <span style="color: #000000;">)</span> <br /> </div>[/code:16j5lm4b] |
filtro entre fechas | Hola, creo que valdría :
( desde <= hasta1 and hasta >= desde1 )
Un saludo. |
filtro entre fechas | [quote="gmart1":32ry7qrv]Hola, creo que valdría :
( desde <= hasta1 and hasta >= desde1 )
Un saludo.[/quote:32ry7qrv]
Con lo que dices no entiendo lo que quieres hacer, si lo que quieres es tomar en cuenta 2 fechas que esten entre un rango incluidas las fechas tomadas, con lo que te puse funciona, pero de verdad ya no se que es lo que quieres, me perdi...saludos...gracias... <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: --> |
filtro entre fechas | José, parece que los tiros van por between. Haré unas pruebas y te comento. Gracias
Saludos |
filtro entre fechas | [quote="horacio":7pabqs5c]José, parece que los tiros van por between. Haré unas pruebas y te comento. Gracias
Saludos[/quote:7pabqs5c]
Fue lo que te sugeri desde un principio, gracias... <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: --> |
filtro entre fechas | Amigos:
Lo que yo entendí es que no se trata de un rango de fechas, para ejemplificar lo que entendí,
supongamos que son campos con nombres, ejemplo:
José Ramírez
Horacio Rocha
Entonces lo que quiere es traer los registros de Horacio Rocha.
Nombre = "Horacio" .AND. Paterno = "Rocha"
Es así?
Saludos |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.