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;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> oWnd, oTmr<br /><br />&nbsp; &nbsp;<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 />&nbsp; &nbsp;<span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">TIMER</span> oTmr &nbsp;<span style="color: #0000ff;">INTERVAL</span> <span style="color: #000000;">10000</span> <span style="color: #0000ff;">ACTION</span> &nbsp;<span style="color: #000000;">&#40;</span>oTmr:<span style="color: #000000;">DeActivate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,oWnd:<span style="color: #0000ff;">Say</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">10</span>, <span style="color: #000000;">17</span>, Time<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>, upload<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,oTmr:<span style="color: #0000ff;">Activate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">of</span> oWnd<br />&nbsp; &nbsp;<span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">TIMER</span> oTmr<br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd ;<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CLICK</span> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Click!"</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;oTmr:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</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;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> oInternet := TInternet<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> oFTP &nbsp; &nbsp; &nbsp;:= TFTP<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</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;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> aFiles<br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> handle<br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> cFile &nbsp; &nbsp; := <span style="color: #ff0000;">""</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">if</span> ! Empty<span style="color: #000000;">&#40;</span> oFTP:<span style="color: #000000;">hFTP</span> <span style="color: #000000;">&#41;</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 />&nbsp; &nbsp;FtpSetCurrentDirectory<span style="color: #000000;">&#40;</span>oFTP:<span style="color: #000000;">hFTP</span>, &nbsp;<span style="color: #ff0000;">"/testinfo/STB1/"</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;aFiles = oFTP:<span style="color: #000000;">Directory</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"*.*"</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">IF</span> len<span style="color: #000000;">&#40;</span>aFiles<span style="color: #000000;">&#41;</span> > <span style="color: #000000;">0</span><br /><br />&nbsp; &nbsp; &nbsp; AEval<span style="color: #000000;">&#40;</span> aFiles, <span style="color: #000000;">&#123;</span> | aFile | <span style="color: #0000ff;">msginfo</span><span style="color: #000000;">&#40;</span> aFile<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span>,cFile := ALLTRIM<span style="color: #000000;">&#40;</span> aFile<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span>,;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FtpGetFile <span style="color: #000000;">&#40;</span>oFTP:<span style="color: #000000;">hFTP</span>,aFile<span style="color: #000000;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</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 />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oFTP:DeleteFile( aFile[ 1 ]) } )<br /><br />&nbsp; &nbsp;ENDIF<br /><br /><br />/*<br />DLL32 FUNCTION FtpGetFile(<br />hFTP AS LONG, &nbsp; &nbsp; &nbsp;= 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 />&nbsp; &nbsp;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;">&#40;</span><span style="color: #000000;">&#41;</span><br />...<br /><br />   WinExec<span style="color: #000000;">&#40;</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;">&#41;</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;">&#40;</span> i, <span style="color: #000000;">3</span> <span style="color: #000000;">&#41;</span>+<span style="color: #ff0000;">".png"</span><br />   logfile<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"trace.log"</span>, <span style="color: #000000;">&#123;</span> cPrnFile, file<span style="color: #000000;">&#40;</span> cPrnFile <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />   <span style="color: #B900B9;">//---------------------------------------------------</span><br />   <br />   <span style="color: #00C800;">WHILE</span> FILE<span style="color: #000000;">&#40;</span> cPrnFile := cDir + <span style="color: #ff0000;">"page"</span>+StrZero<span style="color: #000000;">&#40;</span> i, <span style="color: #000000;">3</span> <span style="color: #000000;">&#41;</span>+<span style="color: #ff0000;">".png"</span> <span style="color: #000000;">&#41;</span><br /><br />      ::<span style="color: #000000;">oPrn</span>:<span style="color: #000000;">StartPage</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />      ::<span style="color: #000000;">oPrn</span>:<span style="color: #000000;">SayBitmap</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, cPrnFile <span style="color: #000000;">&#41;</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;">&#40;</span><span style="color: #000000;">&#41;</span><br />      logfile<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"trace.log"</span>, <span style="color: #000000;">&#123;</span> cPrnFile <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</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&#46;ch" function Main&#40;&#41; MsgInfo&#40; File&#40; CurDir&#40;&#41; + "\test&#46;exe" &#41; &#41; return nil [/code:gu7c3pgh]
file() function
Andrea,You just have to remove the first slash bar:test.prg[code:1xymmd9b] #include "fwce&#46;ch" function Main&#40;&#41; MsgInfo&#40; File&#40; "My Documents\myfile&#46;txt" &#41; &#41; 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&#58;//www&#46;atzwanger-software&#46;com/fw/fileedit1&#46;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&#58;//s17&#46;postimg&#46;org/o8ukn8v7j/Fileedit&#46;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&#58;//wiki&#46;fivetechsoft&#46;com/doku&#46;php?id=fivewin_function_encrypt[/url:2dwig6z4] [url:2dwig6z4]http&#58;//wiki&#46;fivetechsoft&#46;com/doku&#46;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&#58; data lAdd as logical endclass //---------------------------------------------------------------------------// method new&#40;&#41; super&#58;new&#40;,"mete",,&#46;f&#46;&#41; if &#58;&#58;use&#40;&#41; &#58;&#58;addIndex&#40;"mete"&#41; &#58;&#58;addIndex&#40;"mete2"&#41; &#58;&#58;setOrder&#40;1&#41; &#58;&#58;gotop&#40;&#41; msgInfo&#40; &#58;&#58;reccount&#40;&#41;,"reccount&#40;&#41;"&#41; msgInfo&#40; &#58;&#58;fcount&#40;&#41;,"fcount&#40;&#41;"&#41; endif &#58;&#58;lAdd&#58;=&#46;f&#46; return self method browser&#40;&#41; local oDlg,oBrw,oMeter,oFont,oCol,nFor,oChild &#58;&#58;setOrder&#40;2&#41; &#58;&#58;gotop&#40;&#41; 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 &#58;= TXBrowse&#40;&#41;&#58;New&#40; oDlg &#41; oBrw&#58;nMarqueeStyle &#58;= MARQSTYLE_HIGHLCELL oBrw&#58;nColDividerStyle &#58;= LINESTYLE_BLACK oBrw&#58;nRowDividerStyle &#58;= LINESTYLE_BLACK oBrw&#58;lColDividerComplete &#58;= &#46;t&#46; oBrw&#58;nHeaderLines &#58;= 1 oBrw&#58;nFooterLines &#58;= 1 oBrw&#58;nDataLines &#58;= 1 oBrw&#58;lFooter &#58;= &#46;t&#46; oBrw&#58;CreateFromCode&#40;&#41; oBrw&#58;nTop = 0 oBrw&#58;nLeft = 0 oBrw&#58;nWidth = 1000 oBrw&#58;nHeight =600 oBrw&#58;SetRDD&#40;&#41; for nFor &#58;= 1 to &#58;&#58;Fcount&#40;&#41; oBrw&#58;aCols&#91; nFor &#93;&#58;oDataFont &#58;= oFont next // Setup for using database class oBrw&#58;cAlias&#58;= &#58;&#58;cAlias oBrw&#58;bSkip&#58;= &#123;|nRecs| &#58;&#58;skipper&#40; nRecs &#41; &#125; oBrw&#58;bGotop&#58;= &#123;|| &#58;&#58;gotop&#40;&#41; &#125; oBrw&#58;bGoBottom&#58;= &#123;|| &#58;&#58;goBottom&#40;&#41; &#125; oBrw&#58;bBookMark &#58;= &#123;| n | iif&#40; n == nil, &#58;&#58;RecNo&#40;&#41; , &#58;&#58;Goto&#40; n &#41; &#41; &#125; oMeter&#58;= self ACTIVATE DIALOG oDlg ON INIT &#40;oBrw&#58;SetSize&#40; 1000, 600 &#41;, BuildButtons&#40; oMeter,oBrw,oDlg&#41;,oBrw&#58;Refresh&#40;&#46;t&#46;&#41;, oDlg&#58;Refresh&#40;&#46;t&#46;&#41;&#41; RETURN nil //---------------------------------------------------------------------------// function BuildButtons&#40;oMeter, oBrw, oDlg&#41; *-------------------------------------------------- @ 34, 1 BUTTON "&New" OF oDlg SIZE 60, 20 ACTION &#40; oMeter&#58;add&#40;oBrw&#41;,oBrw&#58;refresh&#40;&#41;,oDlg&#58;update&#40;&#41;&#41; @ 34, 15 BUTTON "&Modify" OF oDlg SIZE 60, 20 ACTION &#40; oMeter&#58;edit&#40;oBrw&#41;,oBrw&#58;refresh&#40;&#41;,oDlg&#58;update&#40;&#41;&#41; @ 34, 30 BUTTON "&Delete" OF oDlg SIZE 60, 20 ACTION &#40; oMeter&#58;delete&#40;oBrw,oMeter&#41;&#41; @ 34,45 BUTTON "&Search" OF oDlg SIZE 60, 20 //ACTION addmete&#40; oBrw , oDlg &#41; @ 34,60 BUTTON "&Print" OF oDlg SIZE 60, 20 //ACTION oDlg&#58;Report &#40; "meter reads Report", &#46;t&#46; &#41; @ 36, 1 BUTTON "&Order" OF oDlg SIZE 60, 20//ACTION ordercust&#40;oLbx&#41; SIZE 40, 12 @ 36, 5 BUTTON "&Filter" OF oDlg SIZE 60, 20 ACTION &#40; oMeter&#58;filterreads&#40;oBrw&#41;,oBrw&#58;refresh&#40;&#41;,oDlg&#58;update&#40;&#41;&#41; @ 36, 30 BUTTON "&Unfilter" OF oDlg SIZE 60, 20//ACTION Nonfiltercust&#40;oLbx&#41; SIZE 40, 12 @ 36, 45 BUTTON "&Exit" OF oDlg SIZE 60, 20 //ACTION oDlg&#58;End&#40;&#41; SIZE 40, 12 return nil method add&#40;oBrw&#41; *--------------- &#58;&#58;lAdd&#58;=&#46;t&#46; &#58;&#58;edit&#40;oBrw&#41; &#58;&#58;load&#40;&#41; // in case they cancel &#58;&#58;lAdd&#58;=&#46;f&#46; &#58;&#58;GOTOP&#40;&#41; return self //---------------------------------------------------------------------------// method edit&#40;oBrw&#41; *--------------- local oDlg,oBtnNew local ometer&#58;= TRecord&#40;&#41;&#58;new&#40; self &#41; if &#58;&#58;lAdd ometer&#58;blank&#40;&#41; endif DEFINE DIALOG oDlg FROM 8, 2 TO 600, 700 PIXEL ; TITLE if&#40;&#58;&#58;lAdd,"Untitled","Update"&#41; @ 1,2 SAY "&Serial" OF oDlg PIXEL @ 1,50 SAY "&#58;" OF oDlg PIXEL @ 1,60 GET ometer&#58;me_mc_serl OF oDlg PIXEL UPDATE @ 15,1 SAY "&Meter date" OF oDlg PIXEL @ 15,50 SAY "&#58;" OF oDlg PIXEL @ 15,60 GET ometer&#58;me_date pict &#40;"99/99/9999"&#41; OF oDlg PIXEL UPDATE @ 280, 10 BUTTON oBtnNew PROMPT "&Save" OF oDlg PIXEL SIZE 30, 12 ; ACTION &#40; ometer&#58;save&#40;&#41;, oDlg&#58;end&#40;&#41; &#41; ACTIVATE DIALOG oDlg CENTERED ; ON INIT &#40; oBrw&#58;Refresh&#40;&#41;, oDlg&#58;Update&#40;&#41; &#41; ometer&#58;end&#40;&#41; oDlg&#58;update&#40;&#41; return self //---------------------------------------------------------------------------// method _delete&#40;oBrw,oMeter&#41; *------------------------ if msgYesNo&#40;"Delete this record?"&#41; super&#58;delete&#40;&#41; oMeter&#58;blank&#40;&#41; oMeter&#58;save&#40;&#41; endif &#58;&#58;skip&#40;1&#41; &#58;&#58;skip&#40;0&#41; if oBrw&#58;eof&#40;&#41; &#58;&#58;skip&#40;-1&#41; &#58;&#58;skip&#40;0&#41; endif oBrw&#58;refresh&#40;&#41; return self //---------------------------------------------------------------------------// CLASS TXData from TData METHOD Append&#40;&#41; METHOD filterreads&#40;&#41; MESSAGE Delete METHOD _Delete&#40;&#41; endclass //---------------------------------------------------------------------------// METHOD _Delete&#40;&#41; &#58;&#58;blank&#40;&#41; &#58;&#58;save&#40;&#41; return super&#58;delete&#40;&#41; //---------------------------------------------------------------------------// method filterreads&#40;oBrw&#41; *---------------------- local oDlg,oBtnNew local ometer&#58;= TRecord&#40;&#41;&#58;new&#40; self &#41; local V_me_mc_serl,y,cfilter,bfilter&#58;="" if MsgGet&#40; "Serial Machine", "Enter Serial Machine", @V_me_mc_serl,; "" &#41; select 3 use mach set index to mach5 if ! DbSeek&#40; &#40;V_me_mc_serl &#41;&#41; MsgAlert&#40; "I don't find that serial" &#41; endif endif y &#58;= "'"+padr&#40;V_me_mc_serl,7&#41;+"'" cFilter &#58;= "me_mc_serl = "+ y bFilter = "&#123;||"+cFilter+"&#125;" select mete use mete set index to mete1 DBSETFILTER&#40;&bFilter,cFilter&#41; mete->&#40;DBGOTOP&#40;&#41;&#41; ometer&#58;end&#40;&#41; oDlg&#58;update&#40;&#41; 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;">&#40;</span><span style="color: #ff0000;">'bigdata'</span><span style="color: #000000;">&#41;</span><br />oRs:<span style="color: #000000;">SetFilter</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'datano = 555'</span><span style="color: #000000;">&#41;</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;">&#40;</span><span style="color: #ff0000;">'select * from bigdata where datano = ?'</span>, <span style="color: #000000;">&#123;</span><span style="color: #000000;">555</span><span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</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;">&#40;</span> <span style="color: #ff0000;">"select * from `customer` where `state` = ? and 'age' between ? and ?"</span>, <span style="color: #000000;">&#123;</span> cState, nMinAge, nMaxAge <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</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> &nbsp;<span style="color: #B900B9;">// undocumented.</span><br />&nbsp;</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;">&#40;</span> aNewParams <span style="color: #000000;">&#41;</span><br />oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</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 &#58;="" @ 45,2 SAY "&Country" OF oDlg PIXEL @ 45,50 SAY "&#58;" OF oDlg PIXEL @ 45,200 COMBOBOX oCbx VAR v_co_cocmbo ITEMS aBase&#40;1,"cust",256,"cu_coun",cfilter&#41; size 110,80 ; OF oDlg PIXEL; ON CHANGE &#40;oGet&#58;VarPut&#40;PADR&#40;v_co_cocmbo,30&#41;&#41;,oGet&#58;Refresh&#40;&#41;&#41; @ 45,60 GET oGet VAR cu_coun OF oDlg PIXEL cFilter &#58;="alltrim&#40;upper&#40;"+"cust->cu_coun"+" &#41;&#41;" + '=="' + alltrim&#40;upper&#40;cu_coun&#41;&#41; + '"' @ 60,2 SAY "&City" OF oDlg PIXEL @ 60,50 SAY "&#58;" OF oDlg PIXEL @ 60,200 COMBOBOX oCbx2 VAR v_ci_cocmbo ITEMS aBase&#40;1,"cust",256,"cu_city",cfilter&#41; size 110,80 ; OF oDlg PIXEL; ON CHANGE &#40;oGet2&#58;VarPut&#40;PADR&#40;v_ci_cocmbo,30&#41;&#41;,oGet2&#58;Refresh&#40;&#41;&#41; @ 60,60 GET oGet2 VAR cu_city OF oDlg PIXEL cFilter &#58;="alltrim&#40;upper&#40;"+"cust->cu_city"+"&#41;&#41;" + '=="' + alltrim&#40;upper&#40;cu_city&#41;&#41; + '"' @ 75,2 SAY "&Governer" OF oDlg PIXEL @ 75,50 SAY "&#58;" OF oDlg PIXEL @ 75,200 COMBOBOX oCbx3 VAR v_go_cocmbo ITEMS aBase&#40;1,"cust",256,"cu_gove",cFilter&#41; size 110,80 ; OF oDlg PIXEL; ON CHANGE &#40;oGet3&#58;VarPut&#40;PADR&#40;v_go_cocmbo,30&#41;&#41;,oGet3&#58;Refresh&#40;&#41;&#41; @ 75,60 GET oGet3 VAR cu_gove OF oDlg PIXEL FUNCTION aBase&#40;workarea,dbf_na,arr_size,fld_na,cFilter&#41; //------------------------------------- LOCAL arr&#58;=&#123;&#125;,nAreaActiv&#58;=Select&#40;&#41; LOCAL y&#58;=0 local bFilter&#58;="" aAdd&#40;arr,space&#40;arr_size&#41;&#41; //Put First element empty select &#40;workarea&#41; use &#40;dbf_na&#41; SELE &#40;dbf_na&#41; DBGOTOP&#40;&#41; set filter to &&#40;cFilter&#41; DBGOTOP&#40;&#41; go top WHILE!Eof&#40;&#41; y&#58;=ASCAN&#40;arr,&#40;dbf_na&#41;->&fld_na&#41; if y==0 aAdd&#40;arr,&#40;dbf_na&#41;->&fld_na&#41; dbSkip&#40;&#41; else dbSkip&#40;&#41; endif ENDDO SELE &#40;nAreaActiv&#41; RETURN&#40;arr&#41; [/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&#40;coun->coun_name&#41; to coun database oCoun @ 45,2 SAY "&Country" OF oDlg PIXEL @ 45,50 SAY "&#58;" OF oDlg PIXEL @ 45,180 dbcombo oCbx var v_co_cocmbo; alias oCoun&#58;cAlias; size 100,200 pixel; itemfield "COUN_CODE"; listfield "COUN_NAME"; of oDlg; UPDATE select 6 use city index on upper&#40;city->city_name&#41; to city database oCity set filter to upper&#40;city->coun_name&#41;==upper&#40;v_co_cocmbo&#41; city->&#40;dbgotop&#40;&#41;&#41; @ 60,2 SAY "&City" OF oDlg PIXEL @ 60,50 SAY "&#58;" OF oDlg PIXEL @ 60,180 dbcombo oCbx2 var v_ci_cocmbo; alias oCity&#58;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 "&#58;" OF oDlg PIXEL @ 45,200 COMBOBOX oCbx VAR v_co_cocmbo ITEMS aBase&#40;1,"cust",256,"cu_coun"&#41;; SIZE 110,80 ; OF oDlg PIXEL @ 60,2 SAY "&City" OF oDlg PIXEL @ 60,50 SAY "&#58;" OF oDlg PIXEL @ 60,200 COMBOBOX oCbx2 VAR v_ci_cocmbo ITEMS aBase&#40;1,"cust",256,"cu_city"&#41; size 110,80 ; OF oDlg PIXEL; VALID &#40;reset&#40; v_ci_cocmbo, oCbx2, "cust",1,"cu_city","cu_coun" &#41;, &#46;t&#46;&#41; @ 75,2 SAY "&Governer" OF oDlg PIXEL @ 75,50 SAY "&#58;" OF oDlg PIXEL @ 75,200 COMBOBOX oCbx3 VAR v_go_cocmbo ITEMS aBase&#40;1,"cust",256,"cu_gove"&#41; size 110,80 ; OF oDlg PIXEL; VALID &#40;reset&#40; v_go_cocmbo, oCbx3, "cust",1,"cu_gove","cu_city" &#41;, &#46;t&#46;&#41; FUNCTION aBase&#40;workarea,dbf_na,arr_size,fld_na&#41; //------------------------------------- LOCAL arr&#58;=&#123;&#125;,nAreaActiv&#58;=Select&#40;&#41; LOCAL y&#58;=0 local bFilter&#58;="" aAdd&#40;arr,space&#40;arr_size&#41;&#41; //Put First element empty select &#40;workarea&#41; use &#40;dbf_na&#41; SELE &#40;dbf_na&#41; DBGOTOP&#40;&#41; WHILE!Eof&#40;&#41; y&#58;=ASCAN&#40;arr,&#40;dbf_na&#41;->&fld_na&#41; if y==0 aAdd&#40;arr,&#40;dbf_na&#41;->&fld_na&#41; dbSkip&#40;&#41; else dbSkip&#40;&#41; endif ENDDO SELE &#40;nAreaActiv&#41; RETURN&#40;arr&#41; function reset&#40; cItem, oCbx, cFile ,workarea,fld_na,filtered_fld&#41; //-------------------------------------------------------------- local aItems&#58;=&#123;&#125; local nArea&#58;= select&#40;&#41; local y&#58;=0 select &#40;workarea&#41; use &#40;cFile&#41; set filter to cItem == &#40;workarea&#41;->filtered_fld go top do while ! eof&#40;&#41; y&#58;=ASCAN&#40;aItems,&#40;cFile&#41;->&fld_na&#41; if y==0 aAdd&#40;aItems,&#40;cFile&#41;->&fld_na&#41; dbSkip&#40;&#41; else dbSkip&#40;&#41; endif enddo use select&#40; nArea &#41; oCbx&#58;setItems&#40; aItems &#41; oCbx&#58;refresh&#40;&#41; 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 "&#58;" OF oDlg PIXEL @ 45,200 COMBOBOX oCbx VAR v_co_cocmbo ITEMS aBase&#40;1,"cust",256,"cu_coun"&#41;; SIZE 110,80 ; OF oDlg PIXEL ; VALID &#40;reset&#40; v_co_cocmbo, oCbx2, "cust",1,"cu_city","cu_coun" &#41;, &#46;t&#46;&#41; @ 60,2 SAY "&City" OF oDlg PIXEL @ 60,50 SAY "&#58;" OF oDlg PIXEL @ 60,200 COMBOBOX oCbx2 VAR v_ci_cocmbo ITEMS aBase&#40;1,"cust",256,"cu_city"&#41; size 110,80 ; OF oDlg PIXEL; VALID &#40;reset&#40; v_ci_cocmbo, oCbx3, "cust",1,"cu_gove","cu_city" &#41;, &#46;t&#46;&#41; @ 75,2 SAY "&Governer" OF oDlg PIXEL @ 75,50 SAY "&#58;" OF oDlg PIXEL @ 75,200 COMBOBOX oCbx3 VAR v_go_cocmbo ITEMS aBase&#40;1,"cust",256,"cu_gove"&#41; 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 "&#58;" OF oDlg PIXEL @ 45,200 COMBOBOX oCbx VAR v_co_cocmbo ITEMS aBase&#40;1,"cust",256,"cu_coun"&#41;; SIZE 110,80 ; OF oDlg PIXEL ; VALID &#40;reset&#40; v_co_cocmbo, oCbx2, "cust","cu_city","cu_coun" &#41;, &#46;t&#46;&#41; @ 60,2 SAY "&City" OF oDlg PIXEL @ 60,50 SAY "&#58;" OF oDlg PIXEL @ 60,200 COMBOBOX oCbx2 VAR v_ci_cocmbo ITEMS aBase&#40;1,"cust",256,"cu_city"&#41; size 110,80 ; OF oDlg PIXEL; VALID &#40;reset&#40; v_ci_cocmbo, oCbx3, "cust","cu_gove","cu_city" &#41;, &#46;t&#46;&#41; @ 75,2 SAY "&Governer" OF oDlg PIXEL @ 75,50 SAY "&#58;" OF oDlg PIXEL @ 75,200 COMBOBOX oCbx3 VAR v_go_cocmbo ITEMS aBase&#40;1,"cust",256,"cu_gove"&#41; size 110,80 ; OF oDlg PIXEL function reset&#40; cItem,oCbx,cFile,fld_na,filter_name&#41; //--------------------------------------------------------- local aItems&#58;=&#123;&#125; local nArea&#58;= select&#40;&#41; local y&#58;=0 *select &#40;0&#41; use &#40;cFile&#41; new set filter to cItem == filter_name go top do while ! eof&#40;&#41; y&#58;=ASCAN&#40;aItems,&#40;cFile&#41;->&fld_na&#41; if y==0 aAdd&#40;aItems,&#40;cFile&#41;->&fld_na&#41; dbSkip&#40;&#41; else dbSkip&#40;&#41; endif ENDDO use select&#40; nArea &#41; oCbx&#58;setItems&#40; aItems &#41; oCbx&#58;refresh&#40;&#41; 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&#40;oCombo1,oCombo2,oCombo3,oCombo4,oCombo5,oCombo6,oCombo7,oCombo8,oCombo9,oCombo10&#41; *-------------------------------------------------------------------------------------------------------- LOCAL cPath &#58;= "E&#58;\programs\clipper\fwh\sitex\test&#46;XLS" local oExcel , oBook, oSheet LOCAL nline&#58;=5 local ncol local nCounter&#58;=1 local nStart &#58;= nCounter local cMemo &#58;= '' local a2_fields&#91;12&#93; local a2_vars&#91;12&#93; local cFilter&#58;="" local cValue&#58;="" local i&#58;=0 select 4 use mete index on mete->ME_mc_serl to mete index on str&#40;mete->year&#41; + str&#40;mete->month&#41; to mete1 index on mete->me_date to mete2 a2_fields&#91;1&#93;&#58;="&#40;4&#41;->Me_CU_ACCt" a2_fields&#91;2&#93;&#58;="&#40;4&#41;->Me_CU_name" a2_fields&#91;3&#93;&#58;="&#40;4&#41;->Me_CT_CTNA" a2_fields&#91;4&#93;&#58;="&#40;4&#41;->Me_mc_type" a2_fields&#91;5&#93;&#58;="&#40;4&#41;->Me_mc_modl" a2_fields&#91;6&#93;&#58;="&#40;4&#41;->Me_mc_serl" a2_fields&#91;7&#93;&#58;="&#40;4&#41;->Me_mc_brn" a2_fields&#91;8&#93;&#58;="&#40;4&#41;->Me_mc_mere" a2_fields&#91;9&#93;&#58;="&#40;4&#41;->Me_mc_dep" a2_fields&#91;10&#93;&#58;="&#40;4&#41;->Me_mc_loc" a2_fields&#91;11&#93;&#58;="&#40;4&#41;->Me_date" a2_fields&#91;12&#93;&#58;="&#40;4&#41;->Me_date" a2_vars&#91;1&#93;&#58;=oCombo1 a2_vars&#91;2&#93;&#58;=oCombo2 a2_vars&#91;3&#93;&#58;=oCombo3 a2_vars&#91;4&#93;&#58;=oCombo4 a2_vars&#91;5&#93;&#58;=oCombo5 a2_vars&#91;6&#93;&#58;=oCombo6 a2_vars&#91;7&#93;&#58;=oCombo7 a2_vars&#91;8&#93;&#58;=oCombo8 a2_vars&#91;9&#93;&#58;=oCombo9 a2_vars&#91;10&#93;&#58;=oCombo10 a2_vars&#91;11&#93;&#58;=ctod&#40;"01/06/2006"&#41; a2_vars&#91;12&#93;&#58;=ctod&#40;"30/06/2006"&#41; ? oCombo1 ? oCombo2 ? oCombo3 For i &#58;= 1 to 12 IF Empty&#40;a2_Vars&#91;i&#93;&#41; && Don't process empty variables LOOP ENDIF DO CASE && Create char value CASE VALTYPE&#40;a2_vars&#91;i&#93;&#41; == "D" &#46;AND&#46; i==11 cValue&#58;= 'DTOS&#40;' + a2_Fields&#91;i&#93; + '&#41; >= "' + DTOS&#40;a2_Vars&#91;i&#93;&#41; + '"' CASE VALTYPE&#40;a2_vars&#91;i&#93;&#41; == "D" &#46;AND&#46; i==12 cValue &#58;= 'DTOS&#40;' + a2_Fields&#91;i&#93; + '&#41; <= "' + DTOS&#40;a2_Vars&#91;i&#93;&#41; + '"' CASE VALTYPE&#40;a2_vars&#91;i&#93;&#41; == "N" cValue &#58;= 'STR&#40;' + a2_Fields&#91;i&#93; + '&#41; == "' + STR&#40;a2_vars&#91;i&#93;&#41; + '"' && or CASE VALTYPE&#40;a2_vars&#91;i&#93;&#41; == "C" cValue &#58;="alltrim&#40;upper&#40;"+ a2_Fields&#91;i&#93;+"&#41;&#41;" + '=="' + alltrim&#40;upper&#40;a2_Vars&#91;i&#93;&#41;&#41; + '"' ENDCASE IF Empty&#40;cFilter&#41; && this is the first element cFilter &#58;= cValue ELSE cFilter += " &#46;AND&#46; " + cValue ENDIF NEXT ? &#40;cFilter&#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", 3, 1 &#41;, "Value", "branch" &#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", 3, 2 &#41;, "Value", "Type" &#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", 3, 3 &#41;, "Value", "Model" &#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", 3, 4 &#41;, "Value", "Serial" &#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", 3, 5 &#41;, "Value", "Opening" &#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", 3, 6 &#41;, "Value", "closing" &#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", 3, 7 &#41;, "Value", "prints" &#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", 3, 8 &#41;, "Value", "waste" &#41; select 4 4->&#40;dbgotop&#40;&#41;&#41; set filter to &&#40;cFilter&#41; 4->&#40;dbgotop&#40;&#41;&#41; DO WHILE !&#40;4&#41;->&#40;EOF&#40;&#41;&#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", nLine, 1 &#41;, "Value", &#40;4&#41;->me_mc_brn&#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", nLine, 2 &#41;, "Value", &#40;4&#41;->me_mc_type&#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", nLine, 3 &#41;, "Value", &#40;4&#41;->me_mc_modl&#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", nLine, 4 &#41;, "Value", &#40;4&#41;->me_mc_serl&#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", nLine, 5 &#41;, "Value", &#40;4&#41;->open_meter&#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", nLine, 6 &#41;, "Value", &#40;4&#41;->cls_meter&#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", nLine, 7 &#41;, "Value", &#40;4&#41;->prints&#41; OleSetProperty&#40; OleGetProperty&#40; oSheet, "Cells", nLine, 8 &#41;, "Value", &#40;4&#41;->waste&#41; nLine&#58;=nLine+1 &#40;4&#41;->&#40;DBSKIP&#40;1&#41;&#41; ENDDO OleSetProperty&#40; oExcel, "Visible", &#46;t&#46; &#41; OLEInvoke&#40;oExcel,"Quit"&#41; RETURN NIL [/code:1xgg2jb9]
filtering records in xbrowse
[img:18o99ils]http&#58;//img121&#46;imageshack&#46;us/img121/33/untitledin2&#46;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&#40; oWnd &#41; *-------------------------- local oChild, oBrw Local oDlgn, oDbfc, oBrwc local nRecNo &#58;= RecNo&#40;&#41; local new_rec &#58;= 0 local oGet local i&#58;=0 local nFor local bFilter &#58;= "" local cFilter &#58;= "" local x &#58;= "" REQUEST ADS rddRegister&#40; "ADS", 1 &#41; rddsetdefault&#40; "ADS" &#41; AdsSetDeleted&#40;&#46;T&#46;&#41; SET SERVER LOCAL SET FILETYPE TO CDX x &#58;= "'9855564'" cFilter &#58;= "me_mc_serl = "+ x bFilter = "&#123;||"+cFilter+"&#125;" SELECT 4 use mete SET index TO mete2 DBSETFILTER&#40;&bFilter,cFilter&#41; 4->&#40;DBGOTOP&#40;&#41;&#41; DEFINE DIALOG oDlgn FROM 1,1 TO 50,140 TITLE "Dialog Meter Works" oBrw &#58;= TXBrowse&#40;&#41;&#58;New&#40; oDlgn &#41; oBrw&#58;nMarqueeStyle &#58;= MARQSTYLE_HIGHLCELL oBrw&#58;nColDividerStyle &#58;= LINESTYLE_BLACK oBrw&#58;nRowDividerStyle &#58;= LINESTYLE_BLACK oBrw&#58;lColDividerComplete &#58;= &#46;t&#46; oBrw&#58;nHeaderLines &#58;= 1 oBrw&#58;nFooterLines &#58;= 1 oBrw&#58;nDataLines &#58;= 1 oBrw&#58;lFooter &#58;= &#46;t&#46; oBrw&#58;SetRDD&#40;&#41; SELECT 4 use mete SET index TO mete2 DBSETFILTER&#40;&bFilter,cFilter&#41; 4->&#40;DBGOTOP&#40;&#41;&#41; oBrw&#58;Refresh&#40;&#46;t&#46;&#41; for nFor &#58;= 1 to Fcount&#40;&#41; *if &#40;nFor<16&#41; * loop *endif if nFor=21 oBrw&#58;aCols&#91; nFor &#93;&#58;cHeader &#58;= FieldName&#40; nFor &#41; oBrw&#58;aCols&#91; nFor &#93;&#58;cFooter &#58;= alltrim&#40;STR&#40;TOTALEM2&#40;&#41;,12,0&#41;&#41; loop endif *oBrw&#58;aCols&#91; nFor &#93;&#58;cHeader &#58;= FieldName&#40; nFor &#41; *oBrw&#58;aCols&#91; nFor &#93;&#58;cFooter &#58;= FieldName&#40; nFor &#41; next @ 18, 1 BUTTON "&New" OF oDlgn SIZE 40, 12 ACTION addmeter&#40; oLbx, &#46;t&#46; &#41; @ 18, 8 BUTTON "&Modify" OF oDlgn SIZE 40, 12 //ACTION Editmach&#40; oLbx, &#46;f&#46; &#41; @ 18, 15 BUTTON "&Delete" OF oDlgn SIZE 40, 12 //ACTION Delrecord&#40; oLbx &#41; @ 18, 22 BUTTON "&Search" OF oDlgn SIZE 40, 12 //ACTION Seekmach&#40; oLbx &#41; @ 18, 29 BUTTON "&Print" OF oDlgn ; SIZE 40, 12; ACTION oBrw&#58;Report&#40; "Machines Report", &#46;t&#46; &#41; ; // &#46;t&#46; --> wants preview @ 18, 36 BUTTON "&Exit" OF oDlgn ACTION oDlgn&#58;End&#40;&#41; SIZE 40, 12 @ 19, 1 BUTTON "&Order" OF oDlgn SIZE 40, 12 //ACTION ordermach&#40;oLbx&#41; @ 19, 8 BUTTON "&Filter" OF oDlgn SIZE 40, 12 //ACTION metefilter&#40;oLbx&#41; @ 19, 15 BUTTON "&Unfilter" OF oDlgn SIZE 40, 12 //ACTION filtermachNotOk&#40;oLbx&#41; oBrw&#58;CreateFromCode&#40;&#41; 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&#40;&bFilter,cFilter&#41; 4->&#40;DBGOTOP&#40;&#41;&#41; [/code:3b0w4sn4] [b:3b0w4sn4]replace with this[/b:3b0w4sn4] [code:3b0w4sn4] bFirst &#58;= &#123;|| mete->&#40;DbSeek&#40;cFilter, &#46;t&#46; &#41;&#41; &#125; bLast &#58;= &#123;|| iif&#40;Empty&#40;cFilter&#41;, ; mete->&#40;DbGoBottom&#40;&#41;&#41; , ; &#40;mete->&#40;DbSeek&#40;cFilter+"999",&#46;T&#46;&#41;&#41;, ; meter->&#40;DbSkip&#40;-1&#41;&#41;&#41;&#41; &#125; bWhile &#58;= &#123;|| mete->your_fieldname_for_filter == cFilter &#125; bFor &#58;= &#123;|| &#46;T&#46; &#125; oBrw&#58;bGoTop &#58;= &#123;|| TBFwFirst&#40;bFirst, bWhile, bFor&#41; &#125; oBrw&#58;bGoBottom &#58;= &#123;|| TBFwLast&#40;bLast, bWhile, bFor&#41; &#125; oBrw&#58;bSkip &#58;= &#123;|n| TBFwSkip&#40;n, bWhile, bFor&#41; &#125; [/code:3b0w4sn4] then add this source to your prg file [code:3b0w4sn4] FUNCTION TBFwFirst&#40;bGoFirst, bWhile, bFor&#41; eval&#40;bGoFirst&#41; DO WHILE !eof&#40;&#41; &#46;AND&#46; eval&#40;bWhile&#41; &#46;AND&#46; !eval&#40;bFor&#41; SKIP ENDDO IF !eval&#40;bWhile&#41; // no records match filter - could also be at eof already here GOTO 0 ENDIF RETURN NIL FUNCTION TBFwLast&#40;bGoLast, bWhile, bFor&#41; eval&#40;bGoLast&#41; DO WHILE !bof&#40;&#41; &#46;AND&#46; eval&#40;bWhile&#41; &#46;AND&#46; !eval&#40;bFor&#41; SKIP -1 ENDDO IF bof&#40;&#41; &#46;OR&#46; !eval&#40;bWhile&#41; // No records match scope GOTO 0 ENDIF RETURN NIL FUNCTION TBFwSkip&#40;nToSkip, bWhile, bFor&#41; LOCAL nSkipped &#58;= 0, ; nLastValidRecNum &#58;= Recno&#40;&#41; IF nToSkip = 0 SKIP 0 RETURN 0 ENDIF IF nToSkip > 0 DO WHILE nSkipped < nToSkip &#46;AND&#46; !eof&#40;&#41; &#46;AND&#46; eval&#40;bWhile&#41; SKIP // Note the last clause here makes a big speed difference DO WHILE !eval&#40;bFor&#41; &#46;AND&#46; !eof&#40;&#41; &#46;AND&#46; eval&#40;bWhile&#41; SKIP ENDDO IF Eval&#40;bWhile&#41; &#46;AND&#46; !eof&#40;&#41; // Found a new record matching the scope nSkipped++ nLastValidRecNum &#58;= Recno&#40;&#41; ENDIF ENDDO IF eof&#40;&#41; &#46;OR&#46; !eval&#40;bWhile&#41; GOTO nLastValidRecNum ENDIF ELSE DO WHILE nSkipped > nToSkip &#46;AND&#46; !bof&#40;&#41; &#46;AND&#46; eval&#40;bWhile&#41; SKIP -1 // Note the last clause here makes a big speed difference DO WHILE !eval&#40;bFor&#41; &#46;AND&#46; !bof&#40;&#41; &#46;AND&#46; eval&#40;bWhile&#41; SKIP -1 ENDDO IF Eval&#40;bWhile&#41; &#46;AND&#46; !bof&#40;&#41; nSkipped-- nLastValidRecNum &#58;= Recno&#40;&#41; ENDIF ENDDO IF !eval&#40;bWhile&#41; &#46;OR&#46; bof&#40;&#41; 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&#40; oWnd &#41; *-------------------------- local oChild, oBrw Local oDlgn, oDbfc, oBrwc local nRecNo &#58;= RecNo&#40;&#41; local new_rec &#58;= 0 local oGet local i&#58;=0 local nFor local bFilter &#58;= "" local cFilter &#58;= "" local x &#58;= "" local bFirst,bLast,bWhile,bFor,bGoTop,bGoBottom,bSkip REQUEST ADS rddRegister&#40; "ADS", 1 &#41; rddsetdefault&#40; "ADS" &#41; AdsSetDeleted&#40;&#46;T&#46;&#41; SET SERVER LOCAL SET FILETYPE TO CDX x &#58;= "'9855564'" cFilter &#58;= "me_mc_serl = "+ x bFilter = "&#123;||"+cFilter+"&#125;" SELECT 4 use mete SET index TO mete2 bFirst &#58;= &#123;|| mete->&#40;DbSeek&#40;cFilter, &#46;t&#46; &#41;&#41; &#125; bLast &#58;= &#123;|| iif&#40;Empty&#40;cFilter&#41;, ; mete->&#40;DbGoBottom&#40;&#41;&#41; , ; &#40;mete->&#40;DbSeek&#40;cFilter+"999",&#46;T&#46;&#41;&#41;, ; mete->&#40;DbSkip&#40;-1&#41;&#41;&#41;&#41; &#125; bWhile &#58;= &#123;|| mete->me_mc_serl == cFilter &#125; bFor &#58;= &#123;|| &#46;T&#46; &#125; oBrw&#58;bGoTop &#58;= &#123;|| TBFwFirst&#40;bFirst, bWhile, bFor&#41; &#125; oBrw&#58;bGoBottom &#58;= &#123;|| TBFwLast&#40;bLast, bWhile, bFor&#41; &#125; oBrw&#58;bSkip &#58;= &#123;|n| TBFwSkip&#40;n, bWhile, bFor&#41; &#125; DEFINE DIALOG oDlgn FROM 1,1 TO 50,140 TITLE "Dialog Meter Works" oBrw &#58;= TXBrowse&#40;&#41;&#58;New&#40; oDlgn &#41; oBrw&#58;nMarqueeStyle &#58;= MARQSTYLE_HIGHLCELL oBrw&#58;nColDividerStyle &#58;= LINESTYLE_BLACK oBrw&#58;nRowDividerStyle &#58;= LINESTYLE_BLACK oBrw&#58;lColDividerComplete &#58;= &#46;t&#46; oBrw&#58;nHeaderLines &#58;= 1 oBrw&#58;nFooterLines &#58;= 1 oBrw&#58;nDataLines &#58;= 1 oBrw&#58;lFooter &#58;= &#46;t&#46; oBrw&#58;SetRDD&#40;&#41; oBrw&#58;Refresh&#40;&#46;t&#46;&#41; for nFor &#58;= 1 to Fcount&#40;&#41; *if &#40;nFor<16&#41; * loop *endif if nFor=21 oBrw&#58;aCols&#91; nFor &#93;&#58;cHeader &#58;= FieldName&#40; nFor &#41; oBrw&#58;aCols&#91; nFor &#93;&#58;cFooter &#58;= alltrim&#40;STR&#40;TOTALEM2&#40;&#41;,12,0&#41;&#41; loop endif *oBrw&#58;aCols&#91; nFor &#93;&#58;cHeader &#58;= FieldName&#40; nFor &#41; *oBrw&#58;aCols&#91; nFor &#93;&#58;cFooter &#58;= FieldName&#40; nFor &#41; next @ 18, 1 BUTTON "&New" OF oDlgn SIZE 40, 12 //ACTION addmeter&#40; oLbx, &#46;t&#46; &#41; @ 18, 8 BUTTON "&Modify" OF oDlgn SIZE 40, 12 //ACTION Editmach&#40; oLbx, &#46;f&#46; &#41; @ 18, 15 BUTTON "&Delete" OF oDlgn SIZE 40, 12 //ACTION Delrecord&#40; oLbx &#41; @ 18, 22 BUTTON "&Search" OF oDlgn SIZE 40, 12 //ACTION Seekmach&#40; oLbx &#41; @ 18, 29 BUTTON "&Print" OF oDlgn ; SIZE 40, 12; ACTION oBrw&#58;Report&#40; "Machines Report", &#46;t&#46; &#41; ; // &#46;t&#46; --> wants preview @ 18, 36 BUTTON "&Exit" OF oDlgn ACTION oDlgn&#58;End&#40;&#41; SIZE 40, 12 @ 19, 1 BUTTON "&Order" OF oDlgn SIZE 40, 12 //ACTION ordermach&#40;oLbx&#41; @ 19, 8 BUTTON "&Filter" OF oDlgn SIZE 40, 12 //ACTION metefilter&#40;oLbx&#41; @ 19, 15 BUTTON "&Unfilter" OF oDlgn SIZE 40, 12 //ACTION filtermachNotOk&#40;oLbx&#41; oBrw&#58;CreateFromCode&#40;&#41; 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&#40; oWnd &#41; *-------------------------- local oChild, oBrw local nFor local bFilter &#58;= "" local cFilter &#58;= "" local x &#58;= "" REQUEST ADS rddRegister&#40; "ADS", 1 &#41; rddsetdefault&#40; "ADS" &#41; AdsSetDeleted&#40;&#46;T&#46;&#41; SET SERVER LOCAL SET FILETYPE TO CDX select 4 USE METE x &#58;= "'9855564'" cFilter &#58;= "me_mc_serl = "+ x bFilter = "&#123;||"+cFilter+"&#125;" DBSETFILTER&#40;bFilter,cFilter&#41; DBGOTOP&#40;&#41; DEFINE WINDOW oChild FROM 4, 4 TO 25, 75 ; TITLE "Meter Works" oBrw &#58;= TXBrowse&#40;&#41;&#58;New&#40; oChild &#41; oBrw&#58;nMarqueeStyle &#58;= MARQSTYLE_HIGHLCELL oBrw&#58;nColDividerStyle &#58;= LINESTYLE_BLACK oBrw&#58;nRowDividerStyle &#58;= LINESTYLE_BLACK oBrw&#58;lColDividerComplete &#58;= &#46;t&#46; oBrw&#58;nHeaderLines &#58;= 1 oBrw&#58;nFooterLines &#58;= 1 oBrw&#58;nDataLines &#58;= 2 oBrw&#58;lFooter &#58;= &#46;t&#46; oBrw&#58;SetRDD&#40;&#41; for nFor &#58;= 1 to Fcount&#40;&#41; if nFor=20 oBrw&#58;aCols&#91; nFor &#93;&#58;cHeader &#58;= FieldName&#40; nFor &#41; oBrw&#58;aCols&#91; nFor &#93;&#58;cFooter &#58;= alltrim&#40;STR&#40;TOTALEM2&#40;&#41;,12,0&#41;&#41; loop endif oBrw&#58;aCols&#91; nFor &#93;&#58;cHeader &#58;= FieldName&#40; nFor &#41; oBrw&#58;aCols&#91; nFor &#93;&#58;cFooter &#58;= FieldName&#40; nFor &#41; next oBrw&#58;CreateFromCode&#40;&#41; oChild&#58;oClient &#58;= oBrw ACTIVATE WINDOW oChild MAXIMIZED ON INIT oBrw&#58;SetFocus&#40;&#41; 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;">&#41;</span><br /><span style="color: #00C800;">EndCase</span>    <br />cTab_Art:<span style="color: #000000;">SetNewFilter</span><span style="color: #000000;">&#40;</span>SET_WHERE,cWhere,.t.<span style="color: #000000;">&#41;</span><br />oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</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;">&#41;</span><br /><span style="color: #00C800;">EndCase</span>    <br />cTab_Art:<span style="color: #000000;">SetNewFilter</span><span style="color: #000000;">&#40;</span>SET_WHERE,cWhere,.t.<span style="color: #000000;">&#41;</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;">&#40;</span><span style="color: #ff0000;">"cod_art"</span>,.T.<span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">endif</span><br />oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</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;">&#123;</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;">&#125;</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 />&nbsp;</div>[/code:1k1qjuyb] asi [code=fw:1k1qjuyb]<div class="fw" id="{CB}" style="font-family: monospace;"><br />+Alltrim<span style="color: #000000;">&#40;</span>Str<span style="color: #000000;">&#40;</span>cFolio1<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>+<br />&nbsp;</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;">&#40;</span>Str<span style="color: #000000;">&#40;</span>cFolio1<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"' "</span><br />cSql += <span style="color: #ff0000;">"AND a.nro_rec <= '"</span> + Alltrim<span style="color: #000000;">&#40;</span>Str<span style="color: #000000;">&#40;</span>cFolio2<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</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;">&#40;</span>cSql<span style="color: #000000;">&#41;</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;">&#40;</span>Str<span style="color: #000000;">&#40;</span>cFolio1<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"' "</span><br />cSql += <span style="color: #ff0000;">"AND a.nro_rec <= '"</span> + Alltrim<span style="color: #000000;">&#40;</span>Str<span style="color: #000000;">&#40;</span>cFolio2<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</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;">&#40;</span>cSql<span style="color: #000000;">&#41;</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;">&#40;</span>Str<span style="color: #000000;">&#40;</span>cFolio1<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"' "</span><br />cSql += <span style="color: #ff0000;">"AND a.nro_rec <= '"</span> + Alltrim<span style="color: #000000;">&#40;</span>Str<span style="color: #000000;">&#40;</span>cFolio2<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</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;">&#40;</span>cSql<span style="color: #000000;">&#41;</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;">&#40;</span>FechaInicial<span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">LOCAL</span> hasta := DTOS<span style="color: #000000;">&#40;</span>FechaFinal<span style="color: #000000;">&#41;</span><br /><br />desde1 => desde .AND. hasta1 <= hasta<br />&nbsp;</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;">&#40;</span>s<span style="color: #000000;">&#41;</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;">&#40;</span>s<span style="color: #000000;">&#41;</span><br /><span style="color: #0000ff;">FROM</span> table_name<br /><span style="color: #0000ff;">WHERE</span> <span style="color: #000000;">&#40;</span> column_name1 BETWEEN value1 AND value2 <span style="color: #000000;">&#41;</span> AND/OR <span style="color: #000000;">&#40;</span> column_name2 BETWEEN value1 AND value2 <span style="color: #000000;">&#41;</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