topic
stringlengths 1
63
| text
stringlengths 1
577k
⌀ |
---|---|
oBrw:report() still need help.. | The oBrw:report() needs to end the printing at the point where the filter ends the display of data.The record count is governing the number of pages to print when it should be the filter. Therefore I get 5 extra pages of print. They each have headers but no data.Ive had help from James, Rao and others and we all seem to agree that the report() should respect the filter.Can't get the class to respect the filter only works with the record count.Help. |
oBrw:report() still need help.. | Harvey,Are you using a filter or OrdSetScope() ?For a large database, OrdSetScope() should be used. Filters are slow. |
oBrw:report() still need help.. | Antonio:You said:[quote:3rcgm48q]
Are you using a filter or OrdSetScope() ?
For a large database, OrdSetScope() should be used. Filters are slow[code[/quote:3rcgm48q]using a filter and the data base is 540 records, small. The filter stops about halfway down the data base. But printing keeps going.Why the comment regarding speed? Its the printing of extra pages is the problem. Have no speed issue. |
oBrw:report() still need help.. | Harvey,You have no problems with the speed because you are managing a small amount of records, but if you use a DBF with thousands records, then you will see what I mean <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->Is the browse accessing the same workarea where the filter is set ? |
oBrw:report() still need help.. | Harvey,>Why the comment regarding speed? Its the printing of extra pages is the problem. Have no speed issue.He is saying that scopes are much faster than filters and xBrowse:Report works with scopes.I asked before if you knew about scopes? If not, perhaps you can use scopes instead of filters. Exactly how are you filtering the database? Can we see the code that sets the filter?Regards,James |
oBrw:report() still need help.. | Thanks James:I now understand. I'm not familiar with scopes. Here are the filters under separate conditions.[code:1zxbu0ck]if mquick == 1
gl->(dbseek("3599"))
gl->ty13 := 1
// SCHEDULES
* set filter to .Not. Ty13 = 0 .And. .NOT. Account = "3601";
* .And. .Not. Account = "0100" .And. .Not. Account = "0125" ;
* .And. .Not. Account = "0150" .And. .Not. Account = "0175" ;
* .And. .Not. (Account >= "2055" .And. Account <= "2495") ;
* .And. .Not. (Account >= "2510" .And. Account <= "3352") ;
* .And. .Not. (Account >= "3354" .And. Account <= "3478") ;
* .And. .Not. (Account >= "3482" .And. Account <= "3543") ;
* .And. .Not. Account = "3800" ;
* .And. .Not. Account > "5999"
* skip
* skip -1
// ADD NEW 5 DEPTS.
set filter to .Not. Ty13 = 0 .And. .NOT. Account = "3601";
.And. .Not. Account = "0100" .And. .Not. Account = "0125" ;
.And. .Not. Account = "0150" .And. .Not. Account = "0175" ;
.And. .Not. (Account >= "2055" .And. Account <= "2495") ;
.And. .Not. (Account >= "2510" .And. Account <= "2620") ;
.And. .Not. (Account >= "2630" .And. Account <= "2710") ;
.And. .Not. (Account >= "2730" .And. Account <= "2810") ;
.And. .Not. (Account >= "2830" .And. Account <= "2910") ;
.And. .Not. (Account >= "2930" .And. Account <= "2995") ;
.And. .Not. Account = "3800" ;
.And. .Not. (Account >= "2997" .And. Account <= "3352") ;
.And. .Not. (Account >= "3354" .And. Account <= "3478") ;
.And. .Not. (Account >= "3482" .And. Account <= "3543") ;
.And. .Not. Account = "3800" ;
.And. .Not. Account > "5999"
skip
skip -1
endif
if mquick == 2
gl->(dbseek("3599"))
gl->ty13 := 1
// PUT LINES AT THE BOTTOM OF EACH DEPT TOTAL
gl->(dbseek("3353"))
if gl->ty13 <> 0
gl->(dbseek("3352"))
gl->ty13 := 1
gl->(dbseek("3354"))
gl->ty13 := 1
endif
gl->(dbseek("3544"))
if gl->ty13 <> 0
gl->(dbseek("3543"))
gl->ty13 := 1
gl->(dbseek("3545"))
gl->ty13 := 1
endif
gl->(dbseek("3480"))
if gl->ty13 <> 0
gl->(dbseek("3478"))
gl->ty13 := 1
gl->(dbseek("3482"))
gl->ty13 := 1
endif
gl->(dbseek("2500"))
if gl->ty13 <> 0
gl->(dbseek("2495"))
gl->ty13 := 1
gl->(dbseek("2510"))
gl->ty13 := 1
endif
set filter to .Not. Ty13 = 0 .And. .NOT. Account = "3601" ;
.And. .Not. Account = "0100" .And. .Not. Account = "0125" ;
.And. .Not. Account = "0150" .And. .Not. Account = "0175" ;
.And. .Not. (Account >= "1000" .And. Account <= "2050") ;
.And. .Not. (Account >= "3600" .And. Account <= "5999")
skip
skip -1
endif
if mquick == 3
// 8/30/99
// GET RID OF LINE TOTAL EXPENSES IF ONLY DEFAULT DEP BEING USED
mTest := 0
gl->(dbseek("2500"))
mtest := gl->ty13 + mtest
gl->(dbseek("3480"))
mtest := gl->ty13 + mtest
gl->(dbseek("3544"))
mtest := gl->ty13 + mtest
// FILTER 3600 AND EXTRA LINE
if mtest == 0
expcf->(dbseek("z Total"))
if expcf->usepercomp == .T. // FLAGS USING PERCENT COMPLETE
gl->(dbseek("2040"))
gl->title := "Job costs"
gl->(dbgotop())
select gl
set filter to .Not. Ty13 = 0 .And. .NOT. Account = "3601" ;
.And. .Not. Account = "0100" .And. .Not. Account = "0125" ;
.And. .Not. Account = "0150" .And. .Not. Account = "0175" ;
.And. .Not. (Account >= "2010".and. Account <= "2038") ;
.And. .Not. Account = "3600" ;
.And. .Not. Account = "3602" ;
.And. .Not. Account > "5999"
skip
skip -1
else
set filter to .Not. Ty13 = 0 .And. .NOT. Account = "3601";
.And. .Not. Account = "0100" .And. .Not. Account = "0125" ;
.And. .Not. Account = "0150" .And. .Not. Account = "0175" ;
.And. .Not. (Account >= "2004".and. Account <= "2008") ;
.And. .Not. Account = "3600" ;
.And. .Not. Account = "3602" ;
.And. .Not. Account > "5999"
skip
skip -1
endif
else
expcf->(dbseek("z Total"))
if expcf->usepercomp == .T. // FLAGS USING PERCENT COMPLETE
gl->(dbseek("2040"))
gl->title := "Job costs"
gl->(dbgotop())
select gl
set filter to .Not. Ty13 = 0 .And. .NOT. Account = "3601" ;
.And. .Not. Account = "0100" .And. .Not. Account = "0125" ;
.And. .Not. Account = "0150" .And. .Not. Account = "0175" ;
.And. .Not. (Account >= "2010".and. Account <= "2038") ;
.And. .Not. Account > "5999"
skip
skip -1
else
set filter to .Not. Ty13 = 0 .And. .NOT. Account = "3601";
.And. .Not. Account = "0100" .And. .Not. Account = "0125" ;
.And. .Not. Account = "0150" .And. .Not. Account = "0175" ;
.And. .Not. (Account >= "2004".and. Account <= "2008") ;
.And. .Not. Account > "5999"
skip
skip -1
endif
endif
endif[/code:1zxbu0ck] |
oBrw:report() still need help.. | Harvey,OK, scopes are not going to work for you--you have some of the most complex filters I have ever seen.The fastest solution for you is to just write your own report using TReport. You can probably do this in 15 mintues or so.Granted, it would be nice to modify TXBrwose so it supports filters, but if you need a quick solution, I suggest your own report. It also gives you more flexibility to design the report anyway you wish.Regards,James |
oBrw:report() still need help.. | James:Can't write anything in 15 min. Can you give me a little bit more on what your suggesting. Writing my own function and using TReport as a starting point? |
oBrw:report() still need help.. | Harvey, James,If the filter is set on the same workarea as the used by the browse, then the report should respect the filter.Harvey, please try this:MsgInfo( Alias() )MsgInfo( oBrowse:cAlias )Please check that you are working in the same workarea. |
oBrw:report() still need help.. | Harvey,Just call your report from the same menu or button you are now using for xbrowse:Report(). Here is an example:Regards,James[code:13ufl6lq]// Sample FW Report
function myReport()
local oReport
local cTitle:="Sample Report"
local oCust:= tdata():new(,"arcust")
oCust:use()
REPORT oReport;
TITLE cTitle," ";
HEADER dtoc(date()),time(),;
"Page "+ltrim(str(oReport:nPage)) RIGHT;
CAPTION cTitle;
PREVIEW
COLUMN TITLE "St" DATA oCust:state
COLUMN TITLE "First Name" DATA oCust:first
COLUMN TITLE " Salary" DATA oCust:salary total
oReport:bSkip:= { | nRecs | oCust:skip( nRecs ) }
oReport:lJoin:=.t.
ENDREPORT
activate report oReport while ! oCust:eof()
oCust:end()
return nil[/code:13ufl6lq] |
oBrw:report() still need help.. | Antonio,>If the filter is set on the same workarea as the used by the browse, then the report should respect the filter. Sorry, it does not handle filters. It is relying on ordkeycount() to tell it when it has printed all the records and ordKeyCount() doesn't respect filters.Regards,James |
oBrw:report() still need help.. | James I'll give it a shot. Email later this evening and let you know. Thanks for all the help. |
oBrw:report() still need help.. | Harvey,I noticed in my sample report function that it is not saving and restoring the database state--and it should. Whenever you manipulate an open database in a function you should save and restore it's state as a matter of good programming practice. This will eliminate a lot of bugs.At the top of the function save the workarea and recno, then at the end of the function restore them. If you change anything else like an index order, you should also save and restore that.Regards,James |
oBrw:report() still need help.. | Harvey,I also noticed that my sample is for my own TData so it won't work for you. Here is one that works without a database object.Later we should discuss the merits of database objects. You can read about them on my website here:<!-- m --><a class="postlink" href="http://ourworld.compuserve.com/homepages/jbott/program.htm">http://ourworld.compuserve.com/homepage ... rogram.htm</a><!-- m -->Regards,James[code:11cpq470]// Sample FW Report
function myReport(cAlias)
local oReport
local cTitle:="Sample Report"
local nArea: select()
local nRecno:= 0
select (cAlias)
nRecno:= recno()
go top
REPORT oReport;
TITLE cTitle," ";
HEADER dtoc(date()),time(),;
"Page "+ltrim(str(oReport:nPage)) RIGHT;
CAPTION cTitle;
PREVIEW
COLUMN TITLE "St" DATA state
COLUMN TITLE "First Name" DATA first
COLUMN TITLE " Salary" DATA salary total
oReport:bSkip:= { | nRecs | dbskip( nRecs ) }
oReport:lJoin:=.t.
ENDREPORT
activate report oReport while ! eof()
select( nArea )
go to nRecno
return nil[/code:11cpq470] |
oBrw:report() still need help.. | James,> It is relying on ordkeycount() to tell it when it has printed all the records and ordKeyCount() doesn't respect filters. yes, you are right. It looks as he should use OrdSetScope() instead of filters. |
oBrw:report() still need help.. | Harvey,I think I mentioned before (in another thread) that you should consider moving your filter data to a database so you don't have to recompile your program to change them.It appears that you have three groups of data (three filters). I assume that you have an accounts file, so you should be able to add a field to that file that contains the filter group. Then you can tag each account with the group that it belongs to. Of course, the tags could be changed in a data entry screen so you don't have to hard code them and they could be changed at any time.This is just an example--I would have to know more about your filter groups to propose a good solution.This is probably not something you want to get into now (during your conversion) but it is something to think about for the future.Regards,James |
oBrw:report() still need help.. | Antonio,There is a bug in xbrowse. When you have a filter set and oBrw:refresh() is called, it crashes with the error below. This is the line where it is crashing. I don't know why it thinks eval() is a method.[code:2jtpt1yz] if ! ( ::cAlias )->( Eval( bFilter ) )[/code:2jtpt1yz]
James
[code:2jtpt1yz] Error description: Error BASE/1004 No exported method: EVAL
Args:
[ 1] = L .T.
Stack Calls
===========
Called from: => EVAL(0)
Called from: xbrowse.prg => TXBROWSE:DELREPOS(873)
Called from: xbrowse.prg => TXBROWSE:REFRESH(836)
Called from: xbrowse.prg => TXBROWSE:REPORT(4530)
Called from: Test08.prg => (b)MAIN(22)[/code:2jtpt1yz] |
oBrw:report() still need help.. | Antonio,OK, I think I have a solution. bFilter was not actually a codeblock. This is from the method DelRepos().Regards,James [code:lvb2nli4]elseif ! Empty( cFilter := ( ::cAlias )->( dbFilter() ) )
//bFilter := ( ::cAlias )->( &cFilter )
cFilter := ( ::cAlias )->( &cFilter )
if ! eval( {|| cFilter } ) //( ::cAlias )->( Eval( bFilter ) )[/code:lvb2nli4] |
oBrw:report() still need help.. | Thanks to James problem solved. I'm sure he'll be making some recommendations on xbrowse.He has been a gem in his help.... <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
oBtn:ToolTip - UTF8 encoding fails [Unsolved] | UTF8 encoding fails - switches to Ansi - in BUTTON/[b:8hj53ltp][color=#FF0000:8hj53ltp]TButton[/color:8hj53ltp][/b:8hj53ltp]() and [b:8hj53ltp][color=#FF0000:8hj53ltp]TBtnBmp[/color:8hj53ltp][/b:8hj53ltp]() ToolTips!
Sample:
[code=fw:8hj53ltp]<div class="fw" id="{CB}" style="font-family: monospace;">REQUEST HB_CODEPAGE_UTF8<br /><br /><span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> oDlg, oBtn<br /><br /> FW_SetUnicode<span style="color: #000000;">(</span> .T. <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"UTF8 encoding fails in Button ToolTips (is Ansi)!"</span><br /><br /> @ <span style="color: #000000;">2</span>, <span style="color: #000000;">2</span> <span style="color: #0000ff;">BTNBMP</span> oBtn TOOLTIP <span style="color: #ff0000;">"äöü ß ÄÖÜ éèêë ÉÈÊË"</span><br /> <br /> oBtn := TButtonBmp<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> ;<br /> <span style="color: #000000;">2.5</span>, ; <span style="color: #B900B9;">// <nRow> -</span><br /> <span style="color: #000000;">2</span>, ; <span style="color: #B900B9;">// <nCol> -</span><br /> <span style="color: #ff0000;">"Delete"</span>, ; <span style="color: #B900B9;">// <cCaption> -</span><br /> , ; <span style="color: #B900B9;">// <oWnd> -</span><br /> <span style="color: #000000;">{</span>|| <span style="color: #000000;">(</span> oBtn:<span style="color: #000000;">Hide</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oBtn:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><span style="color: #000000;">}</span>, ; <span style="color: #B900B9;">// <bAction> -</span><br /> , ; <span style="color: #B900B9;">// <nWidth> -</span><br /> , ; <span style="color: #B900B9;">// <nHeight> -</span><br /> , ; <span style="color: #B900B9;">// <nHelpId> -</span><br /> , ; <span style="color: #B900B9;">// <oFont> -</span><br /> .F., ; <span style="color: #B900B9;">// <lDefault> - BS_DEFPUSHBUTTON</span><br /> .F., ; <span style="color: #B900B9;">// <lPixel> -</span><br /> .F., ; <span style="color: #B900B9;">// <lDesign> -</span><br /> , ; <span style="color: #B900B9;">// <cMsg> -</span><br /> .F., ; <span style="color: #B900B9;">// <lUpdate> -</span><br /> , ; <span style="color: #B900B9;">// <bWhen> -</span><br /> , ; <span style="color: #B900B9;">// <bValid> -</span><br /> .F., ; <span style="color: #B900B9;">// <lCancel> -</span><br /> , ; <span style="color: #B900B9;">// <cBitmap> -</span><br /> , ; <span style="color: #B900B9;">// <cPosText> -</span><br /> <span style="color: #ff0000;">"äöü ß ÄÖÜ éèêë ÉÈÊË"</span>, ; <span style="color: #B900B9;">// <cToolTip> -</span><br /> , ; <span style="color: #B900B9;">// <lFlat> -</span><br /> , ; <span style="color: #B900B9;">// <cLayOut> -</span><br /> ; <span style="color: #B900B9;">// <lGDIP> -</span><br /> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// CONSTRUCTOR</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg<br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /> </div>[/code:8hj53ltp]
[img:8hj53ltp]https://i.postimg.cc/P5NpfwBK/2023-11-24-10-41-57.png[/img:8hj53ltp]
For [color=#008000:8hj53ltp]TButtonBmp[/color:8hj53ltp]() encoding is ok:
[img:8hj53ltp]https://i.postimg.cc/43WJSffM/2023-11-24-11-00-22.png[/img:8hj53ltp] |
oBtn:ToolTip - UTF8 encoding fails [Unsolved] | E asi?
[code=fw:154a4ryq]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// C:\FWH\SAMPLES\BTNFROSE.PRG</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br />REQUEST HB_LANG_PT<br />REQUEST HB_CODEPAGE_PT850<br />REQUEST HB_CODEPAGE_UTF8 <span style="color: #B900B9;">// HARBOUR only?</span><br /><br /><span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> oDlg, oBtn<br /><br /> HB_LANGSELECT<span style="color: #000000;">(</span> <span style="color: #ff0000;">'PT'</span> <span style="color: #000000;">)</span><br /> HB_SETCODEPAGE<span style="color: #000000;">(</span> <span style="color: #ff0000;">"PT850"</span> <span style="color: #000000;">)</span><br /> HB_CDPSELECT<span style="color: #000000;">(</span><span style="color: #ff0000;">"UTF8"</span><span style="color: #000000;">)</span><br /><br /> FW_SetUnicode<span style="color: #000000;">(</span> .T. <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"UTF8 encoding fails in Button ToolTips (is Ansi)!"</span><br /><br /> @ <span style="color: #000000;">2</span>, <span style="color: #000000;">2</span> <span style="color: #0000ff;">BTNBMP</span> oBtn TOOLTIP OemToAnsi<span style="color: #000000;">(</span> <span style="color: #ff0000;">"äöü ß ÄÖÜ éèêë ÉÈÊË"</span> <span style="color: #000000;">)</span><br /> <br /> oBtn := TButtonBmp<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> ;<br /> <span style="color: #000000;">2.5</span>, ; <span style="color: #B900B9;">// <nRow> -</span><br /> <span style="color: #000000;">2</span>, ; <span style="color: #B900B9;">// <nCol> -</span><br /> <span style="color: #ff0000;">"Delete"</span>, ; <span style="color: #B900B9;">// <cCaption> -</span><br /> , ; <span style="color: #B900B9;">// <oWnd> -</span><br /> <span style="color: #000000;">{</span>|| <span style="color: #000000;">(</span> oBtn:<span style="color: #000000;">Hide</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oBtn:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><span style="color: #000000;">}</span>, ; <span style="color: #B900B9;">// <bAction> -</span><br /> , ; <span style="color: #B900B9;">// <nWidth> -</span><br /> , ; <span style="color: #B900B9;">// <nHeight> -</span><br /> , ; <span style="color: #B900B9;">// <nHelpId> -</span><br /> , ; <span style="color: #B900B9;">// <oFont> -</span><br /> .F., ; <span style="color: #B900B9;">// <lDefault> - BS_DEFPUSHBUTTON</span><br /> .F., ; <span style="color: #B900B9;">// <lPixel> -</span><br /> .F., ; <span style="color: #B900B9;">// <lDesign> -</span><br /> , ; <span style="color: #B900B9;">// <cMsg> -</span><br /> .F., ; <span style="color: #B900B9;">// <lUpdate> -</span><br /> , ; <span style="color: #B900B9;">// <bWhen> -</span><br /> , ; <span style="color: #B900B9;">// <bValid> -</span><br /> .F., ; <span style="color: #B900B9;">// <lCancel> -</span><br /> , ; <span style="color: #B900B9;">// <cBitmap> -</span><br /> , ; <span style="color: #B900B9;">// <cPosText> -</span><br /> OemToAnsi<span style="color: #000000;">(</span> <span style="color: #ff0000;">"äöü ß ÄÖÜ éèêë ÉÈÊË"</span> <span style="color: #000000;">)</span>, ; <span style="color: #B900B9;">// <cToolTip> -</span><br /> , ; <span style="color: #B900B9;">// <lFlat> -</span><br /> , ; <span style="color: #B900B9;">// <cLayOut> -</span><br /> ; <span style="color: #B900B9;">// <lGDIP> -</span><br /> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// CONSTRUCTOR</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg<br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:154a4ryq]
Regardss, saludos. |
oBtn:ToolTip - UTF8 encoding fails [Unsolved] | thank you for the tip but I can't switch code pages for the following reason:
My application is a translation memory system (TMS) and should support as many languages as possible.
It should therefore be able to [b:4h26k0bf]process, display and edit[/b:4h26k0bf] as many Unicode characters as possible at the [b:4h26k0bf]same time[/b:4h26k0bf], I think UTF8 is the best choice for this.
For example, there is a dialog to display all translations of a term, e.g. 'atmosphere':
[img:4h26k0bf]https://i.postimg.cc/yY1dpzN9/2023-11-24-16-23-02.png[/img:4h26k0bf] |
oBtn:ToolTip - UTF8 encoding fails [Unsolved] | We will look into the issue of tooltips.
Display of Utf8 depends purely on FWH
This has nothing to do with HB_CDPSELECT( "UTF8" ). This setting is useful only for Harbour file and directory functions when these names are in UTF8, applicable mostly for East Asian Language applications.
In my view, keep HB_CDPSELECT( <yourcontrycdp> ) |
oBtn:ToolTip - UTF8 encoding fails [Unsolved] | [quote:140eh9v4]We will look into the issue of tooltips.[/quote:140eh9v4] <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
[quote:140eh9v4]Display of Utf8 depends purely on FWH[/quote:140eh9v4]
Does this mean that we can only use chars provided by FWH, even if we use a different font?
I tried it with the font 'unscii' from [url:140eh9v4]http://viznut.fi/unscii/[/url:140eh9v4], unfortunately without success!
[quote:140eh9v4]This has nothing to do with HB_CDPSELECT( "UTF8" ). This setting is useful only for Harbour file and directory functions when these names are in UTF8, applicable mostly for East Asian Language applications.[/quote:140eh9v4]
Good to know.
[quote:140eh9v4]...UTF8, applicable mostly for East Asian Language applications.[/quote:140eh9v4]
But there are many multibyte characters that occur in other non-East Asian languages and are not included in ANSI! E. g. Characters specific to Central and Eastern European languages (e.g., Czech, Polish, Hungarian) like ?, ?, ?, ?, ?, ?, ?, ?, Š, Ž, etc., available in Latin Extended-A (ISO 8859-2).
[quote:140eh9v4]In my view, keep HB_CDPSELECT( <yourcontrycdp> )[/quote:140eh9v4]
Yes, if you only want to process, display and edit the characters that use the same character set (code page). This is not the case in my environment! |
oBtn:ToolTip - UTF8 encoding fails [Unsolved] | [quote:mg667qq2]UTF8 encoding fails - switches to Ansi - in BUTTON/TButton() and TBtnBmp() ToolTips![/quote:mg667qq2]
Can you please make this modification in "window.prg" and try?
Locate these lines in the METHOD ShowToolTip() of Window.prg:
[code=fw:mg667qq2]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> <span style="color: #00C800;">if</span> IsWindowUnicode<span style="color: #000000;">(</span> ::<span style="color: #000000;">hWnd</span> <span style="color: #000000;">)</span><br /><span style="color: #B900B9;">// cText = HB_UTF8LEFT( cText, 98 )</span><br /> hWnd = CreateToolTipWNew<span style="color: #000000;">(</span> ::<span style="color: #000000;">hWnd</span>, cText, IfNil<span style="color: #000000;">(</span> ::<span style="color: #000000;">lBalloon</span>, lTTBalloon <span style="color: #000000;">)</span>, cTitle, hIcon, nClrFore, nClrBack, nWidth, nDelayTime, nDelayType <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /><span style="color: #B900B9;">// cText = Left( cText, 99 )</span><br /> hWnd = CreateToolTipANew<span style="color: #000000;">(</span> ::<span style="color: #000000;">hWnd</span>, cText, IfNil<span style="color: #000000;">(</span> ::<span style="color: #000000;">lBalloon</span>, lTTBalloon <span style="color: #000000;">)</span>, cTitle, hIcon, nClrFore, nClrBack, nWidth, nDelayTime, nDelayType <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span></div>[/code:mg667qq2]
Replace ALL these lines with this one line:
[code=fw:mg667qq2]<div class="fw" id="{CB}" style="font-family: monospace;">hWnd = CreateToolTipWNew<span style="color: #000000;">(</span> ::<span style="color: #000000;">hWnd</span>, cText, IfNil<span style="color: #000000;">(</span> ::<span style="color: #000000;">lBalloon</span>, lTTBalloon <span style="color: #000000;">)</span>, cTitle, hIcon, nClrFore, nClrBack, nWidth, nDelayTime, nDelayType <span style="color: #000000;">)</span></div>[/code:mg667qq2]
Please try after this change. |
oBtn:ToolTip - UTF8 encoding fails [Unsolved] | [quote:3gqi0bqg]Does this mean that we can only use chars provided by FWH, even if we use a different font?[/quote:3gqi0bqg]
chars provided by FWH?
FWH does NOT provide any chars. FWH does not have any chars of its own.
FWH displays any text using Windows APIs
Any utf8 encoded text of any language in the World can be displayed using any Windows font.
Ansi encoded text containing some accented characters of WU languages can be displayed only with a font created using the corresponding Charset. But most FWH functions display them by converting them to utf8 encoding. (we will fix where there are some inadequacies still). Setting HB_CDPSELECT("UTF8") has nothing to do with this process. |
oBtn:ToolTip - UTF8 encoding fails [Unsolved] | [quote:3jw3hnkf]Any utf8 encoded text of any language in the World can be displayed using any Windows font.[/quote:3jw3hnkf]
This reassures me <!-- s8) --><img src="{SMILIES_PATH}/icon_cool.gif" alt="8)" title="Cool" /><!-- s8) -->
[quote:3jw3hnkf]Please try after this change.[/quote:3jw3hnkf]
??? ???????, ??????????.
Transliterates to "Adi poyindi, dhanyav?d?lu" in english <!-- s:wink: --><img src="{SMILIES_PATH}/icon_wink.gif" alt=":wink:" title="Wink" /><!-- s:wink: -->
[img:3jw3hnkf]https://i.postimg.cc/05LZQKp8/2023-11-26-09-36-32.png[/img:3jw3hnkf] |
oBtn:ToolTip - UTF8 encoding fails [Unsolved] | Thanks
Wondering how do you know my mother tongue?
India has 21 Unicode languages. |
oBtn:ToolTip - UTF8 encoding fails [Unsolved] | Wow, I can't believe. We are downright ridiculous with our 4 multibytes. |
oBtn:ToolTip - UTF8 encoding fails [Unsolved] | [quote:s8j9n2w3]Wondering how do you know my mother tongue?[/quote:s8j9n2w3]
I've asked ChatGPT <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: --> <!-- s:? --><img src="{SMILIES_PATH}/icon_confused.gif" alt=":?" title="Confused" /><!-- s:? --> <!-- s8) --><img src="{SMILIES_PATH}/icon_cool.gif" alt="8)" title="Cool" /><!-- s8) -->
The answer was:
[quote:s8j9n2w3]... In Hyderabad, India, the main languages spoken are Telugu, Urdu and English. Telugu is the predominant language in Hyderabad and Telangana, while Urdu is used as the second official language...[/quote:s8j9n2w3] |
oBtn:ToolTip - UTF8 encoding fails [Unsolved] | WOW |
oButton:hide() & oButton:show() | Antonio and friends,Why the methods :hide() & :show() not works?I had to use the following way:[code:3obuppv8]oDlg:bPainted := {|| showWindow( oButton:hWnd, 0 ) }[/code:3obuppv8]Why? |
oButton:hide() & oButton:show() | Hello JC,You have to use the Button-object oBtn:Show(), oBtn:Hide()A sample to Hide a Button inside a buttonbar to get a spacebetween buttons.[code:17l2du0g]
DEFINE WINDOW oWnd TITLE "Test" MDI MENU TMenu():New()
DEFINE BUTTONBAR oBar OF oWnd SIZE 80, 80 2007 RIGHT
oBar:bClrGrad := { | lInvert | If( ! lInvert, ;
{ { 0.90,11892819,16777215 },{ 0.90,16777215,11892819 } },;
{ { 0.50,128,16777215 }, { 0.50,16777215,128 } } ) }
oBar:nClrText := 0
DEFINE BUTTON oBtn50 OF oBar ACTION Test1() ;
RESOURCE "magic" PROMPT "Project" + CRLF + "Selection" TOOLTIP "Bar-Select"
DEFINE BUTTON oBtn51 OF oBar ACTION Test2() ;
RESOURCE "open" PROMPT "Open" + CRLF + "Project" TOOLTIP "Open Project"
DEFINE BUTTON oBtn52 OF oBar ACTION Test3() ;
RESOURCE "floppy" PROMPT "Save" + CRLF + "Project" TOOLTIP "Save Project"
DEFINE BUTTON oBtn53 OF oBar ACTION Test4() ;
RESOURCE "magic" PROMPT "Create" + CRLF + "EXE-File" TOOLTIP "New EXE-File"
DEFINE BUTTON oBtn54 OF oBar ACTION Test5() ;
RESOURCE "info2" PROMPT "Change" + CRLF + "FWH-Version" TOOLTIP "Change FWH-Version"
// This button is HIDE for a space between last button and exit !!!
// ------------------------------------------------------------------------
DEFINE BUTTON oBtn55 OF oBar ACTION NIL;
RESOURCE "calendar"
oBtn55:Hide()
DEFINE BUTTON oBtn56 OF oBar ACTION oWnd:End() ;
RESOURCE "quit" PROMPT "Exit" TOOLTIP "Close Bar-Gradient"
SET MESSAGE OF oWnd TO "Testing the ButtonBar 2007 Office look" ;
CENTERED CLOCK KEYBOARD 2007
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON PAINT gradpaint0( hDC, oWnd ) ;
VALID MsgYesNo( "Do you want to end?" )
RETURN NIL
[/code:17l2du0g]RegardsUwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
oChild multiple | Buenas tardes, la pregunta es si es posible usar oChild en 2 campos diferentes de un Rowset, por ejemplo
[code=fw:2f1po18n]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oarticulo:<span style="color: #000000;">AddChild</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"select * from grupos where grupo = articulo.grupo"</span> <span style="color: #000000;">)</span><br />oarticulo:<span style="color: #000000;">AddChild</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"select * from lineas where clave= articulo.linea"</span><span style="color: #000000;">)</span><br /> </div>[/code:2f1po18n]
siendo los campos grupo y clave, un campo del codigo correspondiente, y en ambos casos el campo descripcio, es el nombre correspondiente.
y en caso afirmativo, como accesar la descripcion correspondiente del hijo.
Saludos
FWH 1802 harbour 3.2 |
oChild multiple | At present only one Child is supported. |
oCn:ImportFromDBF function autoincrement id feature (Solved) | Hi Mr. Rao,
[quote:1v6hhsc8]If the field type in DBF is "N", it is not an autoincrement field. It is a numeric field and you are ensuring its uniqueness through your program logic. Am I right?[/quote:1v6hhsc8]
Right.
[quote:1v6hhsc8]If you let us know if you want option (a) or (b), we will advise you the suitable way.[/quote:1v6hhsc8]
of course (a). but just for migration of data, my "PLK_ID" 's values should not been changed.
Thanks. |
oCn:ImportFromDBF function autoincrement id feature (Solved) | Hi,
I try to migrate my own tables to MariaDB. I used to DBFCDX.
Most of my tables has a autoincrement field that is maintained for my application. I did not know there was a "+" field type in DBFCDX. So for example my autoincrement field type is "N" and name is "PLK_ID". These field is unique.
[code=fw:8859564j]<div class="fw" id="{CB}" style="font-family: monospace;">cMYAU_ID:=<span style="color: #ff0000;">"PLK_ID"</span><br />ocn:<span style="color: #000000;">importfromdbf</span><span style="color: #000000;">(</span>cPath+<span style="color: #ff0000;">"<span style="color: #000000;">\"</span>+ALLTRIM(aDir[i,1] ), cTableName,,,,cMYAU_ID)</span></div>[/code:8859564j]
I execute these codes and my dbf file imported to mariadb.
There was not added "id" field as an autoincrement field. it is ok.
But My autoincrement field is not set as an AUTOINCREMENT. I can edit in HeidiSQL. But I have lots of tables.
Something I'm doing wrong?
Thanks. |
oCn:ImportFromDBF function autoincrement id feature (Solved) | [quote:1r7buk2h]Most of my tables has a autoincrement field that is maintained for my application. I did not know there was a "+" field type in DBFCDX. So for example my autoincrement field type is "N" and name is "PLK_ID". These field is unique.
[/quote:1r7buk2h]
If the field type in DBF is "N", it is not an autoincrement field. It is a numeric field and you are ensuring its uniqueness through your program logic. Am I right?
In that case, please let us know how do you like to maintain this field in MySql?
(a) As Autoincrement field? In that case, the server itself increments the value and you can not programmatically assign any values to this field.
OR
(b) As a simple numeric field? In that case you should programmatically keep on assigning unique values as when a record is inserted.
Option (a) is desirable.
If you let us know if you want option (a) or (b), we will advise you the suitable way. |
oCn:ImportFromDBF function autoincrement id feature (Solved) | ? |
oCn:ImportFromDBF function autoincrement id feature (Solved) | [code=fw:bta2niqr]<div class="fw" id="{CB}" style="font-family: monospace;">cDBF := cPath + <span style="color: #ff0000;">"<span style="color: #000000;">\"</span> + aDir[ i, 1 ]<br />aStruct := FW_DBFSTRUCT( cDbf )<br />AEVAL( aStruct, { |a| If( a[ 1 ] == "</span>PLK_ID<span style="color: #ff0000;">", a[ 2 ] := "</span>+<span style="color: #ff0000;">", nil ) } )<br />oCn:ImportFromDBF( Lower( cDbf ), nil, nil, nil, aStruct )<br /><br /></span></div>[/code:bta2niqr] |
oCn:ImportFromDBF function autoincrement id feature (Solved) | [quote="nageswaragunupudi":noiumuun][code=fw:noiumuun]<div class="fw" id="{CB}" style="font-family: monospace;">cDBF := cPath + <span style="color: #ff0000;">"<span style="color: #000000;">\"</span> + aDir[ i, 1 ]<br />aStruct := FW_DBFSTRUCT( cDbf )<br />AEVAL( aStruct, { |a| If( a[ 1 ] == "</span>PLK_ID<span style="color: #ff0000;">", a[ 2 ] := "</span>+<span style="color: #ff0000;">", nil ) } )<br />oCn:ImportFromDBF( Lower( cDbf ), nil, nil, nil, aStruct )<br /><br /></span></div>[/code:noiumuun][/quote:noiumuun]
Thank you Mr. Rao. It solved my problem. |
oCn:Insert() - UTF8 encoding fails [Unsolved] | Encoding fails when inserting a character string contains 2-Byte [b:3uiz1ph3]ANSI [/b:3uiz1ph3]character, e. g. '"üäö".
Encoding is OK if the character string contains at least one 2-Byte [b:3uiz1ph3]NON ANSI[/b:3uiz1ph3] character, e. g. "?"
[code=fw:3uiz1ph3]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00C800;">STATIC</span> aStr := <span style="color: #000000;">{</span> <span style="color: #ff0000;">"127.0.0.1, test, root, frose2023"</span>, ;<br /> <span style="color: #ff0000;">"208.91.198.197:3306,fwhdemo,gnraofwh,Bharat@1950"</span>, ;<br /> <span style="color: #ff0000;">"209.250.245.152,fwh,fwhuser,FiveTech@2022"</span> <span style="color: #000000;">}</span><br /><br /><span style="color: #00C800;">STATIC</span> oCn<br />REQUEST HB_CODEPAGE_UTF8<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> oRs<br /> <span style="color: #00C800;">LOCAL</span> cTable := <span style="color: #ff0000;">"test"</span><br /> <span style="color: #00C800;">LOCAL</span> cVar1 := <span style="color: #ff0000;">"üäö"</span><br /><br /> FW_SetUnicode<span style="color: #000000;">(</span> .T. <span style="color: #000000;">)</span><br /> oCn := maria_Connect<span style="color: #000000;">(</span> aStr<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>, .T. <span style="color: #000000;">)</span><br /> oCn:<span style="color: #000000;">bOnLostServer</span> := <span style="color: #000000;">{</span> || Alert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Connection lost! Try again"</span> <span style="color: #000000;">)</span>, .T. <span style="color: #000000;">}</span><br /> MsgRun<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Creating Test Table............."</span>, <span style="color: #ff0000;">"PLEASE WAIT ......."</span>, <span style="color: #000000;">{</span> || CreateSampleTable<span style="color: #000000;">(</span> cTable, .T. <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> <br /> <span style="color: #B900B9;">// Encoding is NOT ok with 2-Byte ANSI character</span><br /> oCn:<span style="color: #000000;">Insert</span><span style="color: #000000;">(</span> cTable, <span style="color: #000000;">{</span> <span style="color: #ff0000;">"test"</span>, <span style="color: #ff0000;">"StrToHex"</span> <span style="color: #000000;">}</span>, <span style="color: #000000;">{</span> cVar1, StrToHex<span style="color: #000000;">(</span> cVar1, <span style="color: #ff0000;">" "</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span>, <span style="color: #000000;">)</span><br /> <br /> <span style="color: #B900B9;">// Encoding is ok with 2-Byte NON ANSI character</span><br /> oCn:<span style="color: #000000;">Insert</span><span style="color: #000000;">(</span> cTable, <span style="color: #000000;">{</span> <span style="color: #ff0000;">"test"</span>, <span style="color: #ff0000;">"StrToHex"</span> <span style="color: #000000;">}</span>, <span style="color: #000000;">{</span> cVar1 + <span style="color: #ff0000;">" ?"</span>, StrToHex<span style="color: #000000;">(</span> cVar1 + <span style="color: #ff0000;">" |?"</span>, <span style="color: #ff0000;">" "</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span>, <span style="color: #000000;">)</span><br /> <br /> oRs := oCn:<span style="color: #000000;">RowSet</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"SELECT * FROM `"</span> + cTable + <span style="color: #ff0000;">"`"</span>, .F. <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">XBrowse</span><span style="color: #000000;">(</span> oRs <span style="color: #000000;">)</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> CreateSampleTable<span style="color: #000000;">(</span> cTable, lDrop <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> cSql := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">LOCAL</span> uResult<br /> <span style="color: #00C800;">Default</span> lDrop := .F.<br /> <span style="color: #B900B9;">//</span><br /> <span style="color: #00C800;">IF</span> lDrop .OR. !oCn:<span style="color: #000000;">TableExists</span><span style="color: #000000;">(</span> cTable <span style="color: #000000;">)</span><br /> cSql += CRLF + <span style="color: #ff0000;">"SET NAMES utf8mb4;"</span><br /> cSql += CRLF + <span style="color: #ff0000;">"SET FOREIGN_KEY_CHECKS = 0;"</span><br /> cSql += CRLF + <span style="color: #ff0000;">"DROP TABLE IF EXISTS `"</span> + cTable + <span style="color: #ff0000;">"`;"</span><br /> cSql += CRLF + <span style="color: #ff0000;">"CREATE TABLE `"</span> + cTable + <span style="color: #ff0000;">"` ("</span><br /> cSql += CRLF + <span style="color: #ff0000;">" `test` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '',"</span><br /> cSql += CRLF + <span style="color: #ff0000;">" `StrToHex` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '',"</span><br /> cSql += CRLF + <span style="color: #ff0000;">" `guid` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT uuid(),"</span><br /> cSql += CRLF + <span style="color: #ff0000;">" `createdt` timestamp NOT NULL DEFAULT current_timestamp(),"</span><br /> cSql += CRLF + <span style="color: #ff0000;">" `modifydt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE CURRENT_TIMESTAMP,"</span><br /> cSql += CRLF + <span style="color: #ff0000;">" PRIMARY KEY (`GUID`) USING BTREE"</span><br /> cSql += CRLF + <span style="color: #ff0000;">") ENGINE = MyISAM CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;"</span><br /> cSql += CRLF + <span style="color: #ff0000;">"SET FOREIGN_KEY_CHECKS = 1;"</span><br /> <br /> uResult := oCn:<span style="color: #000000;">Execute</span><span style="color: #000000;">(</span> cSql,, .T. <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:3uiz1ph3]
[img:3uiz1ph3]https://i.postimg.cc/8PfPNcYT/2023-11-09-10-04-07.png[/img:3uiz1ph3]
Dear Mr. Rao, can you confirm the behavior? |
oCn:Insert() - UTF8 encoding fails [Unsolved] | let me check |
oCn:Insert() - UTF8 encoding fails [Unsolved] | For now, please do not use oCn:Insert(...). We are reviewing this.
Can you please test this and let is know if this works correctly.
[code=fw:1axhc7lo]<div class="fw" id="{CB}" style="font-family: monospace;">cSql := <span style="color: #ff0000;">"INSERT INTO `"</span> + cTable + <span style="color: #ff0000;">"` ( `test` ) VALUES ( ? )"</span><br />? oCn:<span style="color: #000000;">Execute</span><span style="color: #000000;">(</span> cSql, <span style="color: #000000;">{</span> AnsiToUtf8<span style="color: #000000;">(</span> cVar1 <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br />oRs := oCn:<span style="color: #000000;">RowSet</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"SELECT `test`, HEX(`test`) FROM `test`"</span> <span style="color: #000000;">)</span><br />XBROWSER oRs</div>[/code:1axhc7lo] |
oCn:Insert() - UTF8 encoding fails [Unsolved] | Yes, pure sql works!
[b:3fq8z0py]Without[/b:3fq8z0py] AnsiToUtf8()!
Because I have [b:3fq8z0py]completely [/b:3fq8z0py]switched from mixed ASCII-Cp850/Ansi environment to UTF8, i.e. source code (UEStudio) and database DBF/MariaDB.
From now on, I no longer have to worry about the encoding.
No more conversions between the code pages HB_OemToAnsi()/HB_AnsiToOem().
Of course also no AnsiToUtf8()/UTF8ToAnsi().
No more 'garbled' characters due to incorrect conversion.
No loss of characters due to different character sets. <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
oCn:Insert() - UTF8 encoding fails [Unsolved] | [quote:16wn1399] source code (UEStudio) [/quote:16wn1399]
With UEStudio, can we enter constants in Utf8 and save in Utf8?
If so that is far better
But the point is we need to INSERT utf8 text but not ANSI text when the table's charset is utf8 or utf8mb4.
Now, we need to check the method Insert and get back to you. |
oCn:Insert() - UTF8 encoding fails [Unsolved] | [quote:7z68umue]With UEStudio, can we enter constants in Utf8 and save in Utf8?[/quote:7z68umue]
Do you mean [code=fw:7z68umue]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#define</span> cVar3 <span style="color: #ff0000;">"üäö ÜÖÄ ß"</span><br /><span style="color: #00C800;">STATIC</span> cVar1 := <span style="color: #ff0000;">"üäö"</span><br /> </div>[/code:7z68umue] instead of [code=fw:7z68umue]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">LOCAL</span> cVar1 := <span style="color: #ff0000;">"üäö"</span><br /> </div>[/code:7z68umue]?
If so, yes!
[quote:7z68umue]But the point is we need to INSERT utf8 text but not ANSI text when the table's charset is utf8 or utf8mb4.[/quote:7z68umue]
<!-- s8) --><img src="{SMILIES_PATH}/icon_cool.gif" alt="8)" title="Cool" /><!-- s8) --> <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
[quote:7z68umue]Now, we need to check the method Insert and get back to you.[/quote:7z68umue]
Don't hurry, I've a workaround
BTW: I missed [<lFindLast>] in ::Seek() <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( -->
have to torture myself with DESCEND and LIMIT <!-- s:roll: --><img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" /><!-- s:roll: --> |
oCn:Insert() - UTF8 encoding fails [Unsolved] | [quote:p1622ys3]BTW: I missed [<lFindLast>] in ::Seek() <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( -->
[/quote:p1622ys3]
Thanks for asking.
We will provide soon and if necessary, will provide with the revised libs. |
oCn:insert - Not inserting data (SOLVED) | With this code, i was trying to insert a line whenever a selected row will be processed.
I have seen the topic, (from version 16.08) I have 16.11
oCn:Insert( "changes", "bond, naam, voornaam,oldploeg,newploeg,datum", { oBrw:naam, oBrw:voornaam, oBrw:p2017, cPloeg, date() } )
I believe this should work. The oCn is open and working : FWCONNECT oCn HOST cServer USER cUser PASSWORD cPassword DATABASE cDatabase
I see no error when this code is executed.
What should I change?
[code=fw:cqiknjs9]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">function</span> setploeg<span style="color: #000000;">(</span>oBrw,cPloeg<span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> uSavePos := oBrw:<span style="color: #000000;">BookMark</span><br /><br /> <span style="color: #00C800;">if</span> msgYesNo<span style="color: #000000;">(</span>str<span style="color: #000000;">(</span>LEN<span style="color: #000000;">(</span>oBRW:<span style="color: #000000;">aSELECTED</span><span style="color: #000000;">)</span>,<span style="color: #000000;">3</span><span style="color: #000000;">)</span>+<span style="color: #ff0000;">"-> Geselecteerde leden verplaatsen"</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">FOR</span> I = <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> LEN<span style="color: #000000;">(</span>oBRW:<span style="color: #000000;">aSELECTED</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// obrw:aSELECTED is an array containing recnos marked</span><br /> oCn:<span style="color: #000000;">Insert</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"changes"</span>, <span style="color: #ff0000;">"bond, naam, voornaam,oldploeg,newploeg,datum"</span>, <span style="color: #000000;">{</span> oBrw:<span style="color: #000000;">naam</span>, oBrw:<span style="color: #000000;">voornaam</span>, oBrw:<span style="color: #000000;">p2017</span>, cPloeg, date<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /> oBrw:<span style="color: #000000;">BookMark</span> := oBrw:<span style="color: #000000;">aSelected</span><span style="color: #000000;">[</span> i <span style="color: #000000;">]</span> <span style="color: #B900B9;">// works for dbf, rowset, ado and all</span><br /> oBrw:<span style="color: #000000;">p2017</span>:<span style="color: #000000;">VarPut</span><span style="color: #000000;">(</span> cPloeg <span style="color: #000000;">)</span> <span style="color: #B900B9;">// Works for dbf, rowset, ado and all</span><br /> <span style="color: #00C800;">next</span><br /> <span style="color: #00C800;">endif</span><br /><br /> oBrw:<span style="color: #000000;">BookMark</span> := uSavePos<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:cqiknjs9] |
oCn:insert - Not inserting data (SOLVED) | Marc
Here is the code I use for multiple selected rows in xBrowse
[code=fw:f6894ktn]<div class="fw" id="{CB}" style="font-family: monospace;"><br />aCols := oLbx:<span style="color: #000000;">aSelected</span><br /><br /><span style="color: #00C800;">For</span> i = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> Len<span style="color: #000000;">(</span>aCols<span style="color: #000000;">)</span><br /><br /> oLbx:<span style="color: #000000;">BookMark</span> := aCols<span style="color: #000000;">[</span>i<span style="color: #000000;">]</span><br /> _TransFer<span style="color: #000000;">(</span> oRsInvt,oWnd,oLbxMain,oRsDetail,;<br /> oWndChildD,oRsRepair,@lTaxable,oTaxable,oFontB,oFontBig,nRepairNumber,;<br /> oLabor,oParts,oMisc,oTax,oTotal,nAssignedTo,cLoc,cTaxSet,;<br /> oLbx,oBtn1,oBtn2,oBtn3 <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Next</span><br /> </div>[/code:f6894ktn]
_Transfer() opens a recordset and I oRs:AddNew() .. modify my fields and oRs:Update() .. I find opening and updating a recordset much more straight forward and easier for me to code than to do a Sql Set Insert. I realize you are probably using My Sql which is coded a bit differently.
Review the For Next loop above to access your bookmarked ( hi-lighted rows ) and you can update your table accordingly.
Rick Lipkin |
oCn:insert - Not inserting data (SOLVED) | Rick,
Every item from Xbrowse in the loop is updated correctly !
I want to insert a new row in a database 'changes' so I can trace changes that have been made by others.
oCn:Insert( "changes", "bond, naam, voornaam,oldploeg,newploeg,datum", { oBrw:naam, oBrw:voornaam, oBrw:p2017, cPloeg, date() } )
The insert should do this, but nothing happens (also no error)
I suppose that it is later than version 16.11. |
oCn:insert - Not inserting data (SOLVED) | oCn:Insert(...) works in all versions.
Please see this part of your code:
[code=fw:hhgbc5ne]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #000000;">{</span> oBrw:<span style="color: #000000;">naam</span>, oBrw:<span style="color: #000000;">voornaam</span>, oBrw:<span style="color: #000000;">p2017</span>, cPloeg, date<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> </div>[/code:hhgbc5ne]
oBrw:naam returns the column object, not value. That is the error.
You should be using
[code=fw:hhgbc5ne]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #000000;">{</span> oBrw:<span style="color: #000000;">naam</span>:<span style="color: #000000;">Value</span>, oBrw:<span style="color: #000000;">voornaam</span>:<span style="color: #000000;">Value</span>, oBrw:<span style="color: #000000;">p2017</span>:<span style="color: #000000;">Value</span>, cPloeg, date<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> </div>[/code:hhgbc5ne]
During development, I advise you to set oCn:lShowErrors := .t |
oCn:insert - Not inserting data (SOLVED) | That was it.
I had more issues with missing this.... Also solved..
Thanks. |
oCol:bStrData with oBrw filled by array? | How I can exchange this code to works... when oBrw is filled by an array![code:2lm2x02k]
oCol := ::oCol( "cHeader" )
::getWidth( replicate( "B", len( eval( oCol:bStrData ) ) ), oCol:oDataFont )[/code:2lm2x02k]With this, the fivewin returns an error like this: [b:2lm2x02k]Class 'Nil' no exported method BSTRDATA[/b:2lm2x02k] |
oCol:bStrData with oBrw filled by array? | When we set an array for xbrowse, it only keeps in mind the array element number. The browse creates all codeblocks like bEditValue, bStrData, bOnPostEdit and also calculates the width required, aligment depending on the data type and such other things while executing the createfromcode().In fact xbrowse does the same calculation you have given above on its own and decides the width before activation of the browse. So that we are relieved of all these complex calculations. There is really no need for us to go through the calculation of width by ourselves.Still for academic interest, if you want to see what the codeblocks the xbrowse constructs, you may call oCol:Adjust() and then use bStrData.My personal advice is let the xbrowse do its job of all these mundane calculations. It does its job fairly well and in most cases, better than us. I find it better to tell xbrowse what to browse and let it do the rest.Let us tell what column number to browse and the picture and header. It does the rest.If you give your full code, perhaps I can explain it better |
oCol:bStrData with oBrw filled by array? | Nages,Thanks for your tip... I will try to use ::adjust() after reallocate the headers and values of columns! |
oCol:bStrData with oBrw filled by array? | [quote="JC":20s0le9i]Nages,
Thanks for your tip... I will try to use ::adjust() after reallocate the headers and values of columns![/quote:20s0le9i]OkBut I wonder why do you need to do it at all? Xbrowse does exactly the same calculations you are trying to do. May I know your purpose, if you dont mind ? I am just curious |
oCol:bStrData with oBrw filled by array? | [quote:hgh78z1a]Ok
But I wonder why do you need to do it at all? Xbrowse does exactly the same calculations you are trying to do. May I know your purpose, if you dont mind ? I am just curious[/quote:hgh78z1a]Dear Nages,This is my source:[code:hgh78z1a] oBrw := TXBrowse():new( oDlg )
oBrw:SetArray( aDataArray, .T., 2 )
oBrw:aCols[1]:cHeader := ""
oBrw:aCols[1]:nWidth := 30
oBrw:aCols[1]:setCheck( { "IMG_CHECK_ON", "IMG_CHECK_OFF" } )
oBrw:aCols[1]:cSortOrder := NIL
oBrw:aCols[2]:cHeader := "Code"
oBrw:aCols[2]:nWidth := 50
oBrw:aCols[2]:nDataStrAlign := AL_CENTER
oBrw:aCols[3]:cHeader := "Name"
oBrw:aCols[3]:nWidth := 330
oBrw:aCols[3]:nDataStrAlign := AL_LEFT[/code:hgh78z1a]
After this, I want to adjust the with of columns where the xBrowse truncate the information because the new size of columns headers.
When I execute the ::adjust(), this error returns to me:
[code:hgh78z1a]
Application
===========
Path and name: C:\app.EXE (32 bits)
Size: 1,430,528 bytes
Time from start: 0 hours 1 mins 7 secs
Error occurred at: 11/09/2008, 08:42:23
Error description: Error BASE/1004 Class: 'NIL' has no exported method: NESCAPEMENT
Args:
[ 1] = U
Stack Calls
===========
Called from: => NESCAPEMENT(0)
Called from: C:\FWH\source\classes\xbrowse.prg => FONTESC(8124)
Called from: C:\FWH\source\classes\xbrowse.prg => TXBRWCOLUMN:HEADERWIDTH(6339)
Called from: C:\FWH\source\classes\xbrowse.prg => TXBRWCOLUMN:ADJUST(6191)
Called from: C:\FWH\source\classes\xbrowse.prg => TXBROWSE:ADJUST(748)
[/code:hgh78z1a] |
oCol:bStrData with oBrw filled by array? | Hello JCoBrw:aCols[1]:cSortOrder := NIL I think :< cSortOrder > has to be the header-string of a col.RegardsUwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
oCol:bStrData with oBrw filled by array? | [quote="ukoenig":2r7nn87k]Hello JC
oBrw:aCols[1]:cSortOrder := NIL
I think :
< cSortOrder > has to be the header-string of a col.
Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->[/quote:2r7nn87k]Uwe,You are right! But, when You want to "disable" the seek order for one column is necessary to set cSetOrder to Nil... like the testxbr3.prg sample! |
oCol:bStrData with oBrw filled by array? | My doubt is: How I can get the real size of a value column of xBrowse filled with an array? |
oCol:bStrData with oBrw filled by array? | [quote="ukoenig":12nmztvn]Hello JC
oBrw:aCols[1]:cSortOrder := NIL
I think :
< cSortOrder > has to be the header-string of a col.
Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->[/quote:12nmztvn]cSortOrder can be nil if the column is not to be sorted.If we want the xbrowse to sort the column,a) for arrays cSortOrder should be the Array Element Number ( Numeric ) on which the data is to be sorted.b) for any RDD, cSortOrder should be the name of the IndexTag c) For RecordSet it should be the fieldname on which we want the data to be sorted.d) For Database Objects like TDataBase or TData, the name used by the SetOrder method of the objectIf we dont want the xbrowse to help us with auto-sorting and we insist on having our own way, then still the old method of defining the bLClickHeader action block is still available but thats a tedious way of coding. |
oCol:bStrData with oBrw filled by array? | Mr JCI have executed your code as it is ( just substituted bitmap names). The widths are okay.Now, to know more about how xbrowse auto-calculates the widths: If we ourselves specify the width xbrowse does not do any calculations and blindly adopts the width we specify. If we have not specified the widths, it evaluates the bStrData ( while executing the method CreateFromCode ) and calculates the width of the evaluated value in pixels and adds bitmap width if necessaray. Finally it takes the maximum of data width, Header width and footer width. Normally these calculations give satisfactory results.The problem with Arrays is that the browse calculates the widths on the basis of the data in the first row of the array. In case the data in the first row are smaller in width, values in the next rows are truncated. In case of RDD and RecSets this problem does not arise "normally" if we specify the column name.So when we browse arrays it becomes necessary for us to specify the widths manually in our program. But the problem is that we have to specify the widths in Pixels and we do not know the exact fit.I wish someday xbrowse provides a way to specify the widths in number of characters ( easy for us to specify ) than pixels and the xbrowse calculating the width on the basis of the number of characters.Till then I adopt a work around. I always know how many characters are to be shown. So I invariably give picture clauses. For text I give a picture clause like 'XXXXX'. Now all my array browses are fit exactly.for example I would write @ 0,0 XBROWSE oBrw ; HEADERS '', 'Code', 'Name' ; PICTURE NIL, REPLICATE( 'X', 5 ), REPLICATE( 'X', 30 ) ; ARRAY aDataArray AUTOSORT AUTOCOLS ..... etc. |
oCol:bStrData with oBrw filled by array? | I have used this solution for my problem... but, I don't know if it's is the best way to do![code:vucu52dt]cHeader := "anything_for_header" <- Only for exhibition because this is generated automatically!!
oCol := ::oCol( cHeader )
nLenHeader := ::getWidth( replicate( "B", len( cHeader ) ) )
nLenData := ::getWidth( replicate( "B", len( ::aArrayData[1, oCol:nArrayCol] ) ), oCol:oDataFont )
oCol:nWidth := max( nLenHeader, nLenData )[/code:vucu52dt] |
oControl en Window | Antonio,
Veo que no está la data oControl en la clase Window. ¿Como puedo hacer que un control de una WINDOW tenga alineación cliente?
Saludos y gracias,
José Luis Capel |
oData - data interchange for today | Perhaps this subject could use its own discussion thread.
Today's programs are focused on data sharing. Having a desktop, mobile, web, or server application is great, but they all need to be able to communicate with each other, and share data, if they want to be relevant in today's technology.
Microsoft formulated, and then released to the public, oData for sharing data. It is freely available for all platforms and is now being used to supply data from one source to another. From the website [url:1ed6g7dp]http://www.odata.org[/url:1ed6g7dp] the following statement is taken:
[quote:1ed6g7dp] The Open Data Protocol (OData) is a Web protocol for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today. OData does this by applying and building upon Web technologies such as HTTP, Atom Publishing Protocol (AtomPub) and JSON to provide access to information from a variety of applications, services, and stores. The protocol emerged from experiences implementing AtomPub clients and servers in a variety of products over the past several years. OData is being used to expose and access information from a variety of sources including, but not limited to, relational databases, file systems, content management systems and traditional Web sites. [/quote:1ed6g7dp]
In the past, we have only weakly embraced protocals for sharing data ( ie. XML, POP/SMTP, FTP ) and alternative data ( ie. SQL ). However, if we are to move forward in the next few years, our tools need to fully embrace SQL and oData with classes that make it as simple to use as it is in other development tools.
oData is available for Windows, iOS, and Android. It works with SQL, cloud servers, and common web languages. Many large corporations have embraced it and have data services available through oData.
I would encourage you to look at the website ([url:1ed6g7dp]http://www.odata.org[/url:1ed6g7dp]) to learn more about it, and I would encourage the Five Tech community to supplement FiveWin with an oData class. |
oData - data interchange for today | "Implementing OData: the Good, the Bad, and the Ugly"
<!-- m --><a class="postlink" href="http://channel9.msdn.com/Events/Open-Specifications-Plugfests/Odata-Meetup-2012/Implementing-OData-the-Good-the-Bad-and-the-Ugly">http://channel9.msdn.com/Events/Open-Sp ... d-the-Ugly</a><!-- m -->
A nice intro to OData: <!-- m --><a class="postlink" href="http://www.codeproject.com/Articles/393623/OData-Services">http://www.codeproject.com/Articles/393 ... a-Services</a><!-- m --> |
oData - data interchange for today | FYI - ADS version 11, now implements oData. So you can also communicate with your .dbfs using this protocol. Useful for handhelds, phones (including the iphone), tablets, and any newer devices using any development language without the need for any additional client layers.
Reinaldo. |
oData - data interchange for today | I will have to look at that since I do have Version 11 installed. |
oData - data interchange for today | Yes. It's called Advantage Web Platform and you can see demo videos here:
<!-- m --><a class="postlink" href="http://devzone.advantagedatabase.com/dz/screencasts/v11_demos/webconfig/webconfigdemo.html">http://devzone.advantagedatabase.com/dz ... gdemo.html</a><!-- m -->
Hope that helps,
Reinaldo. |
oDbf:Delete() error | I have two database
I must delete the User and all permission of this user
The user is deleted as you can see here
[b:4ggqc55y]USERS[/b:4ggqc55y]
[img:4ggqc55y]https://i.postimg.cc/rwLk4ZSP/u.png[/img:4ggqc55y]
The permissions are not deleted ( sometimes two or three records are deleted)
[img:4ggqc55y]https://i.postimg.cc/ry1XkN6G/p.png[/img:4ggqc55y]
I not understood why
the function to delete is this
[code=fw:4ggqc55y]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">Static</span> <span style="color: #00C800;">Function</span> UtBorra<span style="color: #000000;">(</span>oUtenti,oPermessi,oGrid2,oGrid3,oBtnCambia<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> cClave:= alltrim<span style="color: #000000;">(</span>oUtenti:<span style="color: #000000;">Clave</span><span style="color: #000000;">)</span> <br /> <span style="color: #00C800;">IF</span> lABC .AND. !oUtenti:<span style="color: #000000;">EoF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> MsgYesNo<span style="color: #000000;">(</span><span style="color: #ff0000;">"Cancellare i permessi dell'utente "</span>+Alltrim<span style="color: #000000;">(</span>oUtenti:<span style="color: #000000;">Nombre</span><span style="color: #000000;">)</span>+<span style="color: #ff0000;">"?"</span>,<span style="color: #ff0000;">"Confermare!"</span><span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Seek</span><span style="color: #000000;">(</span>cClave<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> !oPermessi:<span style="color: #000000;">EoF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> alltrim<span style="color: #000000;">(</span>oPermessi:<span style="color: #000000;">Usuario</span><span style="color: #000000;">)</span>==cClave<br /> oPermessi:<span style="color: #000000;">Delete</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> oPermessi:<span style="color: #000000;">Skip</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDDO</span><br /> oUtenti:<span style="color: #000000;">Delete</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oGrid2:<span style="color: #000000;">GoUp</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oGrid2:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oGrid2:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> Rinfresca<span style="color: #000000;">(</span>nMod,oUtenti,oPermessi,oGrid2,oGrid3,oBtnCambia<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ELSE</span><br /> <span style="color: #00C800;">ENDIF</span><br /> oGrid2:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #000000;">(</span><span style="color: #00C800;">NIL</span><span style="color: #000000;">)</span><br /> </div>[/code:4ggqc55y]
the key and the name of the user is always 8 characters but I put an alltrim () because it can be even less than 8 characters like for example "TEST"
on the oPermessi there is a SetScope
static cKey
cKey:=oUtenti:Clave
oPermessi:setscope(cKey)
I did not understand why sometimes some records are cacenalled and other times none and other times only one,
[b:4ggqc55y]Another test made this morning [/b:4ggqc55y]
[img:4ggqc55y]https://i.postimg.cc/Y9DQhys4/jh.png[/img:4ggqc55y]
yet putting an xbrowser after the seek makes me see all the modules of that user but then does not delete them all
Any solution ?
a test sample to try the problem
[code=fw:4ggqc55y]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #00C800;">static</span> cKey,lABC<br /><br />request dbfcdx<br />request dbffpt<br /><br /><span style="color: #00C800;">Function</span> test<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">local</span> ctest:=<span style="color: #ff0000;">"Test"</span><br /><br />RddSetDefault<span style="color: #000000;">(</span> <span style="color: #ff0000;">"DBFCDX"</span> <span style="color: #000000;">)</span><br /> oUtenti:= TUtenti<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 /> oModuli:= TModuli<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 /> oPermessi:=TPermessi<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 /><br /> lABC :=.t.<br /><br /> xbrowser oUtenti<br /> xbrowser oPermessi<br /><br /> oPermessi:<span style="color: #000000;">SetOrder</span><span style="color: #000000;">(</span><span style="color: #000000;">2</span><span style="color: #000000;">)</span><br /> cKey:=oUtenti:<span style="color: #000000;">Clave</span><br /> oPermessi:<span style="color: #000000;">setscope</span><span style="color: #000000;">(</span>cKey<span style="color: #000000;">)</span><br /> xbrowser oPermessi<br /><br /> UtBorra<span style="color: #000000;">(</span>oUtenti,oPermessi<span style="color: #000000;">)</span><br /><br /> xbrowser oPermessi<br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><br /><span style="color: #00C800;">Static</span> <span style="color: #00C800;">Function</span> UtBorra<span style="color: #000000;">(</span>oUtenti,oPermessi<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> cClave:= alltrim<span style="color: #000000;">(</span>oUtenti:<span style="color: #000000;">Clave</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// può essere meno di 8 caratteri data errore</span><br /> <span style="color: #00C800;">IF</span> lABC .AND. !oUtenti:<span style="color: #000000;">EoF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> MsgYesNo<span style="color: #000000;">(</span><span style="color: #ff0000;">"Cancellare i permessi dell'utente "</span>+Alltrim<span style="color: #000000;">(</span>oUtenti:<span style="color: #000000;">Nombre</span><span style="color: #000000;">)</span>+<span style="color: #ff0000;">"?"</span>,<span style="color: #ff0000;">"Confermare!"</span><span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Seek</span><span style="color: #000000;">(</span>cClave<span style="color: #000000;">)</span><br /> xbrowser oPermessi<br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> !oPermessi:<span style="color: #000000;">EoF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> alltrim<span style="color: #000000;">(</span>oPermessi:<span style="color: #000000;">Usuario</span><span style="color: #000000;">)</span>==cClave<br /> oPermessi:<span style="color: #000000;">Delete</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> oPermessi:<span style="color: #000000;">Skip</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDDO</span><br /> oUtenti:<span style="color: #000000;">Delete</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> *oGrid2:<span style="color: #000000;">GoUp</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> *oGrid2:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> *oGrid2:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> *Rinfresca<span style="color: #000000;">(</span>nMod,oUtenti,oPermessi,oGrid2,oGrid3,oBtnCambia<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ELSE</span><br /> <span style="color: #00C800;">ENDIF</span><br /> * oGrid2:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #000000;">(</span><span style="color: #00C800;">NIL</span><span style="color: #000000;">)</span><br /><br /><br /><br /><br /><br /><br /><span style="color: #00C800;">CLASS</span> TXData <span style="color: #0000ff;">from</span> TDataBase<br /> <span style="color: #00C800;">DATA</span> cExePath <span style="color: #0000ff;">init</span> cFilePath<span style="color: #000000;">(</span>GetModuleFileName<span style="color: #000000;">(</span> GetInstance<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDCLASS</span><br /><br /><br /><span style="color: #00C800;">CLASS</span> TUtenti <span style="color: #0000ff;">from</span> TXData<br /> <span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENDCLASS</span><br /><br /><span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span> lShared <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TUtenti<br /> <span style="color: #00C800;">Default</span> lShared := .t.<br /> ::<span style="color: #00C800;">super</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span>,::<span style="color: #000000;">cExePath</span> + <span style="color: #ff0000;">"Utenti"</span> ,, lShared<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">use</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">setOrder</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">gotop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">Self</span><br /><span style="color: #B900B9;">//----------------------------------------------------------------------moduli</span><br /><span style="color: #00C800;">CLASS</span> TModuli <span style="color: #0000ff;">from</span> TXData<br /> <span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENDCLASS</span><br /><br /><span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span> lShared <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TModuli<br /> <span style="color: #00C800;">Default</span> lShared := .t.<br /> ::<span style="color: #00C800;">super</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span>,::<span style="color: #000000;">cExePath</span> + <span style="color: #ff0000;">"Moduli"</span> ,, lShared<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">use</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">setOrder</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">gotop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">Self</span><br /><span style="color: #B900B9;">//----------------------------------------------------------------------Permessi</span><br /><span style="color: #00C800;">CLASS</span> TPermessi <span style="color: #0000ff;">from</span> TXData<br /> <span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENDCLASS</span><br /><br /><span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span> lShared <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TPermessi<br /> <span style="color: #00C800;">Default</span> lShared := .t.<br /> ::<span style="color: #00C800;">super</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span>,::<span style="color: #000000;">cExePath</span> + <span style="color: #ff0000;">"Permessi"</span> ,, lShared<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">use</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">setOrder</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">gotop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">Self</span><br /><br /><br /><br /> </div>[/code:4ggqc55y]
write to me at silvio[dot]falconi[at]gmail[dot]com if you need the dbfs to test it |
oDbf:Delete() error | When you want to delete multiple records for a given condition
oDbf:Lock()
oDbf:Exec( { || DELETE FOR <cond> } )
oDbf:Unlock() |
oDbf:Delete() error | Nages,
someone (an american boy) sad me not use lock and unlock (and commit) because
tdatabase make it auto. |
oDbf:Delete() error | [quote="Silvio.Falconi":3s21ccww]Nages,
someone (an american boy) sad me not use lock and unlock (and commit) because
tdatabase make it auto.[/quote:3s21ccww]
Not FLOCK |
oDbf:Delete() error | then
DO WHILE !oPermessi:EoF()
oPermessi:Lock()
oPermessi:Exec( { || DELETE FOR oPermessi:Usuario==oUtenti:Clave } )
oPermessi:Unlock()
oPermessi:Skip()
ENDDO
is it right ?
make me error
source\test.prg(688) Error E0030 Syntax error "syntax error at 'FOR'"
1 error |
oDbf:Delete() error | [quote="Silvio.Falconi":vk72jpcg]then
DO WHILE !oPermessi:EoF()
oPermessi:Lock()
oPermessi:Exec( { || DELETE FOR oPermessi:Usuario==oUtenti:Clave } )
oPermessi:Unlock()
oPermessi:Skip()
ENDDO
is it right ?
make me error
source\test.prg(688) Error E0030 Syntax error "syntax error at 'FOR'"
1 error[/quote:vk72jpcg]
No, it's not
As i see it, the
oPermessi:Lock() // is actually a Flock and therefore not needed in a loop
oPermessi:Exec( { || DELETE FOR oPermessi:Usuario==oUtenti:Clave } ) // block that run all data inside the exec(), so not in a loop
Only the 3 lines from Mr. Rao seems to be needed.
the <cond> is the tricky part... what code is needed
// other post :
If you want to delete all records where the field INVNUM == nInvoice, i.e., "1234567890128", then:
[code]
Local nInvoice := "1234567890128"
oPartres:Exec( <||
DELETE ALL FOR ALLTRIM(FIIELD->INVNUM) == nInvoice
> )
[code]
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=37616&hilit=delete+for">viewtopic.php?f=3&t=37616&hilit=delete+for</a><!-- l --> |
oDbf:Delete() error | Maybe this will do it almost...
[code=fw:gvsvvl7d]<div class="fw" id="{CB}" style="font-family: monospace;"><br />nInvoice := <span style="color: #ff0000;">"1234567890128"</span><br />oPermessi:<span style="color: #000000;">Lock</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /><br />oPermessi:<span style="color: #000000;">Exec</span><span style="color: #000000;">(</span> <|| DELETE ALL <span style="color: #00C800;">FOR</span> ALLTRIM<span style="color: #000000;">(</span>FIELD->INVNUM<span style="color: #000000;">)</span> == nInvoice > <span style="color: #000000;">)</span> <span style="color: #B900B9;">// here your code</span><br /><br />oPermessi:<span style="color: #000000;">Unlock</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> </div>[/code:gvsvvl7d] |
oDbf:Delete() error | [quote="Marc Venken":3levbstj]Maybe this will do it almost...
[code=fw:3levbstj]<div class="fw" id="{CB}" style="font-family: monospace;"><br />nInvoice := <span style="color: #ff0000;">"1234567890128"</span><br />oPermessi:<span style="color: #000000;">Lock</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /><br />oPermessi:<span style="color: #000000;">Exec</span><span style="color: #000000;">(</span> <|| DELETE ALL <span style="color: #00C800;">FOR</span> ALLTRIM<span style="color: #000000;">(</span>FIELD->INVNUM<span style="color: #000000;">)</span> == nInvoice > <span style="color: #000000;">)</span> <span style="color: #B900B9;">// here your code</span><br /><br />oPermessi:<span style="color: #000000;">Unlock</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> </div>[/code:3levbstj][/quote:3levbstj]
usuario and clave are 8 cr
DO WHILE !oPermessi:EoF()
oPermessi:Lock()
oPermessi:Exec( { || DELETE FOR alltrim(oPermessi:Usuario)==oUtenti:Clave } )
oPermessi:Unlock()
oPermessi:Skip()
ENDDO
I tried also with oPermessi:Exec( { || DELETE FOR alltrim(FIELD->Usuario)==oUtenti:Clave } )
give me an error on compilation |
oDbf:Delete() error | Now run ok
DO WHILE !oPermessi:EoF()
oPermessi:Lock()
oPermessi:Exec( { ||
DELETE FOR ALLTRIM(oPermessi:Usuario)==ALLTRIM(oUtenti:Clave)
} )
oPermessi:Unlock()
oPermessi:Skip()
ENDDO
and it delete all records but only some records because on Permessi dbf there is a filter, it deleted only that record have M = 5 <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> |
oDbf:Delete() error | Now run ok
[code=fw:2gumpi6a]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">Static</span> <span style="color: #00C800;">Function</span> UtBorra<span style="color: #000000;">(</span>oUtenti,oPermessi,oGrid2,oGrid3,oBtnCambia<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> cClave:= oUtenti:<span style="color: #000000;">Clave</span><br /> cKey:=<span style="color: #000000;">(</span>oUtenti:<span style="color: #000000;">Clave</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> lABC .AND. !oUtenti:<span style="color: #000000;">EoF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> MsgYesNo<span style="color: #000000;">(</span><span style="color: #ff0000;">"Cancellare i permessi dell'utente "</span>+Alltrim<span style="color: #000000;">(</span>oUtenti:<span style="color: #000000;">Nombre</span><span style="color: #000000;">)</span>+<span style="color: #ff0000;">"?"</span>,<span style="color: #ff0000;">"Confermare!"</span><span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Seek</span><span style="color: #000000;">(</span>cClave<span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">SetScope</span><span style="color: #000000;">(</span>cKey<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> !oPermessi:<span style="color: #000000;">EoF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Lock</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Exec</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> ||<br /> DELETE <span style="color: #00C800;">FOR</span> ALLTRIM<span style="color: #000000;">(</span>oPermessi:<span style="color: #000000;">Usuario</span><span style="color: #000000;">)</span>==ALLTRIM<span style="color: #000000;">(</span>oUtenti:<span style="color: #000000;">Clave</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Unlock</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Skip</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDDO</span><br /> oUtenti:<span style="color: #000000;">Delete</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oGrid2:<span style="color: #000000;">GoUp</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oGrid2:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oGrid2:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> Rinfresca<span style="color: #000000;">(</span>nMod,oUtenti,oPermessi,oGrid2,oGrid3,oBtnCambia<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ELSE</span><br /> <span style="color: #00C800;">ENDIF</span><br /> oGrid2:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #000000;">(</span><span style="color: #00C800;">NIL</span><span style="color: #000000;">)</span><br /><br /> </div>[/code:2gumpi6a] |
oDbf:Delete() error | Hey Silvio,
Great that you have it working !
Could you please try this function (1 loop less that yours) for my personel curiossity ?
I would like to know if
oPermessi:Exec( { ||
DELETE FOR ALLTRIM(oPermessi:Usuario)==ALLTRIM(oUtenti:Clave)
} )
acts like a dbeval and processes all scopes records...
[code=fw:26a6maw1]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">Static</span> <span style="color: #00C800;">Function</span> UtBorra<span style="color: #000000;">(</span>oUtenti,oPermessi,oGrid2,oGrid3,oBtnCambia<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> cClave:= oUtenti:<span style="color: #000000;">Clave</span><br /> cKey:=<span style="color: #000000;">(</span>oUtenti:<span style="color: #000000;">Clave</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> lABC .AND. !oUtenti:<span style="color: #000000;">EoF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> MsgYesNo<span style="color: #000000;">(</span><span style="color: #ff0000;">"Cancellare i permessi dell'utente "</span>+Alltrim<span style="color: #000000;">(</span>oUtenti:<span style="color: #000000;">Nombre</span><span style="color: #000000;">)</span>+<span style="color: #ff0000;">"?"</span>,<span style="color: #ff0000;">"Confermare!"</span><span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Seek</span><span style="color: #000000;">(</span>cClave<span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">SetScope</span><span style="color: #000000;">(</span>cKey<span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Lock</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Exec</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> ||<br /> DELETE <span style="color: #00C800;">FOR</span> ALLTRIM<span style="color: #000000;">(</span>oPermessi:<span style="color: #000000;">Usuario</span><span style="color: #000000;">)</span>==ALLTRIM<span style="color: #000000;">(</span>oUtenti:<span style="color: #000000;">Clave</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Unlock</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oUtenti:<span style="color: #000000;">Delete</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oGrid2:<span style="color: #000000;">GoUp</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oGrid2:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oGrid2:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> Rinfresca<span style="color: #000000;">(</span>nMod,oUtenti,oPermessi,oGrid2,oGrid3,oBtnCambia<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ELSE</span><br /> <span style="color: #00C800;">ENDIF</span><br /> oGrid2:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #000000;">(</span><span style="color: #00C800;">NIL</span><span style="color: #000000;">)</span><br /><br /> </div>[/code:26a6maw1] |
oDbf:Delete() error | [code=fw:335t1axt]<div class="fw" id="{CB}" style="font-family: monospace;"> oPermessi:<span style="color: #000000;">Lock</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Exec</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> ||<br /> DELETE <span style="color: #00C800;">FOR</span> ALLTRIM<span style="color: #000000;">(</span>Usuario<span style="color: #000000;">)</span>==ALLTRIM<span style="color: #000000;">(</span>oUtenti:<span style="color: #000000;">Clave</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> </div>[/code:335t1axt]
The DELETE FOR statement should be PURE RDD statement, |
oDbf:Delete() error | Maybe try this:
[code=fw:3vd8c248]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> oPermessi:<span style="color: #000000;">Lock</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Exec</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> |oUtenti|<br /> DELETE <span style="color: #00C800;">FOR</span> ALLTRIM<span style="color: #000000;">(</span>Usuario<span style="color: #000000;">)</span>==ALLTRIM<span style="color: #000000;">(</span>oUtenti:<span style="color: #000000;">Clave</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span></div>[/code:3vd8c248] |
oDbf:Delete() error | [quote="James Bott":9fi2s4v2]Maybe try this:
[code=fw:9fi2s4v2]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> oPermessi:<span style="color: #000000;">Lock</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Exec</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> |oUtenti|<br /> DELETE <span style="color: #00C800;">FOR</span> ALLTRIM<span style="color: #000000;">(</span>Usuario<span style="color: #000000;">)</span>==ALLTRIM<span style="color: #000000;">(</span>oUtenti:<span style="color: #000000;">Clave</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span></div>[/code:9fi2s4v2][/quote:9fi2s4v2]
This gives wrong results.
Exec method evaluates the codeblock with Self as parameter.
[code=fw:9fi2s4v2]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">METHOD</span> Exec<span style="color: #000000;">(</span> bBlock <span style="color: #000000;">)</span> <span style="color: #00C800;">INLINE</span> <span style="color: #000000;">(</span> ::<span style="color: #000000;">cAlias</span> <span style="color: #000000;">)</span>-><span style="color: #000000;">(</span> Eval<span style="color: #000000;">(</span> bBlock, <span style="color: #00C800;">Self</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> </div>[/code:9fi2s4v2]
So, the variable oUtenti gets the value of oPermiessi inside this codeblock. |
oDbf:Delete() error | [quote="Marc Venken":3eyvaj1r]Hey Silvio,[/quote:3eyvaj1r]
Mark,
on my procedure when I delete a User I must delete all permissions of that user , but when I call ut_borra() function to delete that use I have on Permission dbf a set scope
Now with the new fwh ( april 2021) I can erase that setscope with setscope(nil), then I can delete all the permissions of that user with
[code=fw:3eyvaj1r]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> !oPermessi:<span style="color: #000000;">EoF</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Lock</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Exec</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> ||<br /> DELETE <span style="color: #00C800;">FOR</span> ALLTRIM<span style="color: #000000;">(</span>oPermessi:<span style="color: #000000;">Usuario</span><span style="color: #000000;">)</span>==ALLTRIM<span style="color: #000000;">(</span>oUtenti:<span style="color: #000000;">Clave</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Unlock</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oPermessi:<span style="color: #000000;">Skip</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDDO</span></div>[/code:3eyvaj1r]
then I can delete the user with oUtenti:Delete()
before it is not working because need a Flock (1) and I had the setscope on Usuario field ( user) (2)
with these two problems only some records were deleted, but now it seems to work fine
[img:3eyvaj1r]https://i.postimg.cc/TYLbKmLz/gg.jpg[/img:3eyvaj1r]
I didn't see the deleted records and I trusted them
I did not see them because the dbf was indexed with condition! Deleted ()
and then there was the scope on the user and on the number of menus (green box)
so if I selected a user in the xbrowse above I could not see the records in the xbrowse that it was below,
I didn't select it because the user had been deleted but his permissions were still in the archive |
oDbf:Delete() error | Silvio,
This seems like a prefect time to make the delete-user-rights a method of the user database class. Actually, you
need to delete the users rights whenever a user is deleted so it should also part of the delete() method of the user class.
There would be no occasion where you would want to delete the user and leave their rights.
However, if there is an occasion where you might want to delete all of a user's rights, without deleting the user, then perhaps deleting all the users rights should be a separate method. This way it will be called automatically when the user is deleted, but it could also be called separately to delete all a user's rights without deleting the user.
And I don't really think you need to update the visual grids as you are deleting, since this would only take a second or two. Then you could refresh the grids.
[code=fw:agten2io]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">// Delete the user in this database and their permissions</span><br /><span style="color: #B900B9;">// in the permissions database. This way you cannot delete a user</span><br /><span style="color: #B900B9;">// without deleting their permissions also. </span><br /><span style="color: #00C800;">Method</span> Delete<span style="color: #000000;">(</span> cUser <span style="color: #000000;">)</span> <span style="color: #00C800;">Class</span> TUtenti<br /> <span style="color: #00C800;">Local</span> lSuccess := .F.<br /> <span style="color: #00C800;">Local</span> nOrder<br /> <span style="color: #00C800;">Local</span> oPermessi<br /> <br /> <span style="color: #00C800;">if</span> cUser != <span style="color: #00C800;">nil</span><br /> nOrder:= indexOrd<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">setOrder</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// Assuming 1 is the primary key</span><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">seek</span><span style="color: #000000;">(</span>cUser<span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">Delete</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> lSuccess:=.T.<br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">else</span> <span style="color: #B900B9;">// delete the current record</span><br /> ::<span style="color: #000000;">Delete</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> lSuccess:=.t.<br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #B900B9;">// Can't delete the user without deleting their rights</span><br /> <span style="color: #00C800;">if</span> lSuccess <span style="color: #B900B9;">// if user was deleted</span><br /> ::<span style="color: #000000;">DeleteRights</span><span style="color: #000000;">(</span>cUser<span style="color: #000000;">)</span> <span style="color: #B900B9;">// then delete their rights also</span><br /> <span style="color: #00C800;">endif</span><br /> <br /> ::<span style="color: #000000;">setOrder</span><span style="color: #000000;">(</span>nOrder<span style="color: #000000;">)</span><br /> <br /><span style="color: #00C800;">Return</span> lSuccess<br /><br /><span style="color: #B900B9;">// Delete all the user's rights also.</span><br /><span style="color: #B900B9;">// Parameter cUser is optional, otherwise it uses the current user record</span><br /><span style="color: #00C800;">Method</span> DeleteRights<span style="color: #000000;">(</span>cUser<span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TUtenti<br /> <span style="color: #00C800;">Local</span> cUser<br /> <span style="color: #00C800;">if</span> cUser != <span style="color: #00C800;">nil</span><br /> cUser:= ::<span style="color: #000000;">nombre</span> <span style="color: #B900B9;">// is that the fieldname?</span><br /> <span style="color: #00C800;">endif</span><br /> <br /> oPermessi:=TPermessi<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 /> oPermessi:<span style="color: #000000;">SetOrder</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// primary key index</span><br /> <span style="color: #00C800;">Do</span> <span style="color: #00C800;">while</span> ::<span style="color: #000000;">seek</span><span style="color: #000000;">(</span>cUser<span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">Delete</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> lSuccess:=.T.<br /> <span style="color: #00C800;">enddo</span><br /> oPermessi:<span style="color: #000000;">end</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">Return</span> lSuccess<br /><span style="color: #B900B9;">// EOF</span></div>[/code:agten2io]
Note that this code has not been tested so there may be errors.
Think OOP.
James |
oDbf:modified() no regresa a .F. después de guardar el reg. | Tengo problemas con el uso de oDbf:modified()
¿Es posible que odbf:Modified() (ni oDbf:Updated() en su caso) no pase a .F. aún después de realizar oDbf:save() seguido de su correspondiente oDbf:Commit()?
Saludos |
oDbf:modified() no regresa a .F. después de guardar el reg. | Thanks for pointing this out.
Method Save() should have called ::Load().
We shall fix this in next version.
For now, please use this workaround:
After calling oDbf:Save(), please call oDbf:Load() |
oDbf:modified() no regresa a .F. después de guardar el reg. | Then I should wait until your next release. It is impossible for me to do it that way since I have my own Scatter and Gather beside (and above) those provided by Odbf and it will be a nightmare to reload data and gather in my 230 variables anew (has to do with Dbase field limitations and I was forced to use memo fields to subdivide them in several ones for the problem at hand like in the good all days in assembler). <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: --> |
oDbf:modified() no regresa a .F. después de guardar el reg. | I suppose you are using FWH13.05
For scatter/gather FWH provides two alternatives.
1. You can use Tdatabase class.
2. If you continue using DBF directly, you can use TDataRow class.
TDatabase class:
For the problem you pointed out in this post we have two alternatives.
(a) Call oDbf:Load() after calling oDbf:Save()
OR
(b) Make this modification in database.prg and link with your project.
Please go to line no 1049 in method Save()
Between "endif" in line 1049 and next "endif" in line 1050 insert a line
::Load()
TDataRow() class.
You may use normal DBFs
Instead of legacy scatter/gather functions
oRec := TDataRow():New( <cAlias> )
You can refer to fields of the DBF like
? oRec:<fieldname>
oRec:<fieldname> := NewVaue
You can also create dialogs with @ r,c GET oRec:Amount PICTURE ....
When finished you can all'
oRec:Save()
This will save the modified data in the same record.
Example:
USE CUSTOMER NEW SHARED ALIAS CUST
SKIP 10
oRec := TDataRow():New( "CUST" )
? oRec:Age
oRec:Age := 50
? oRec:Modified()
oRec:Save()
There is also a default simple edit dialog
oRec:Edit() |
oDbf:modified() no regresa a .F. después de guardar el reg. | Thanks for your prompt and extensive response. I suppose you mean between lines 1046 and 1047 (2 consecutive ENDIFs of method save() class Tdatabase)
Will try. |
oDbf:modified() no regresa a .F. después de guardar el reg. | yes |
oDlg as oClient of oWnd (MDICHILD) | Dear All,
Just trying to do this..
...
Define Window MDICHILD...
.........Define Dialog (CHILD)
.........Active Dialog NOWAIT
.........[b:1qelorff]oWnd:oClient := oDlg[/b:1qelorff] //runtime here.. "Message not found: TDIALOG:ADJCLIENT"
Activate Window
...
The goal is to bind oDlg as child to oWnd (MDI CHILD)
Is this possible?
Mr. Antonio?
regards,
Frances |
oDlg as oClient of oWnd (MDICHILD) | Hello Frances
Try this way
[code=fw:3h19vlq9]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><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> oWndMain, oWndChild, oDlg<br /> <span style="color: #00C800;">LOCAL</span> oMenu<br /> <br /> <span style="color: #0000ff;">MENU</span> oMenu<br /> <span style="color: #0000ff;">MENUITEM</span> <span style="color: #ff0000;">"Test"</span> <span style="color: #0000ff;">ACTION</span> LoadMdiChild<span style="color: #000000;">(</span> oWndMain <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">ENDMENU</span><br /> <br /> <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWndMain <span style="color: #0000ff;">MDI</span> <span style="color: #0000ff;">MENU</span> oMenu<br /> <br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWndMain<br /> <br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> LoadMdiChild<span style="color: #000000;">(</span> oWndMain <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> oWndChild, oDlg <br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWndChild <span style="color: #0000ff;">MDICHILD</span> <span style="color: #0000ff;">OF</span> oWndMain<br /> <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">OF</span> oWndChild <span style="color: #0000ff;">STYLE</span> nOR<span style="color: #000000;">(</span> WS_VISIBLE, WS_CHILD <span style="color: #000000;">)</span><br /><br /> oWndChild:<span style="color: #000000;">bResized</span> = <span style="color: #000000;">{</span>| nType, nWidth, nHeight | WndAdjClient<span style="color: #000000;">(</span> oDlg:<span style="color: #000000;">hWnd</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">NOWAIT</span><br /> <br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWndChild<br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> <br /> </div>[/code:3h19vlq9] |
oDlg as oClient of oWnd (MDICHILD) | Dear Daniel,
Thanks for the help..
Yours is much simplier which is better than mine..
Mine:
[code=fw:vafzuk52]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> oWndOP:<span style="color: #000000;">bResized</span> := <span style="color: #000000;">{</span>|nType, nWidth, nHeight| oDlgOP:<span style="color: #000000;">SetSize</span><span style="color: #000000;">(</span> oWndOP:<span style="color: #000000;">oWndClient</span>:<span style="color: #000000;">nWidth</span>,;<br /> oWndOP:<span style="color: #000000;">oWndClient</span>:<span style="color: #000000;">nHeight</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> </div>[/code:vafzuk52]
Both works but I now prefer WndAdjClient( oDlgOP:hWnd )
Regards,
Frances |
oDlg as oClient of oWnd (MDICHILD) | Frances,
It is advisable to avoid the use of such dialogbox so there is just one mdi child window and its controls. Here you have a working example (using a resource dialog to design the controls):
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?p=31982#p31982">viewtopic.php?p=31982#p31982</a><!-- l -->
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?p=32134#p32134">viewtopic.php?p=32134#p32134</a><!-- l -->
There is a working example in FWH\samples\TestMDir.prg |
oDlg as oClient of oWnd (MDICHILD) | Dear Mr. Antonio,
Thank you for pointing the right way.. It enlightens my perception in binding child dialog to window mdichild.
I will revise my project and provide or post feedback here.
My best regards,
Frances |
oDlg:Refresh() does not refresh the all component in dialog. | Hi,I have a working test program as below. One dialog box, one folder and there are three says and gets. When I press the change button first value of get set another value and odlg:Refresh should be refresh the screen in ACTION. but does not. In this condition, If I click the first get, my new value is appears in first get.if I use oGet1:Refresh() instead of oDlg:Refresh(), it is ok. But I have 7 page in one folder, I have more then one gets and says (some of them changeable). I could not refresh all components one by one.I try to write the All_Refresh function. It refresh all of components but there are some painting problems.Is there any way to do refresh all components in dialog?Thanks in advance.[code:13qee3ub]
#include "FiveWin.ch"
function Main()
LOCAL oGet1, oGet2, oGet3, oGet4, oGet5, obtnCancel, obtnChg
LOCAL oFnt, oFnt2, oDlg, oFld, oGrp, oGrp1
LOCAL xVekNo := 11, xREFNO := SPACE(15), xNOTER := SPACE(20)
DEFINE FONT oFnt NAME "Verdana" SIZE 0, -16 BOLD
DEFINE FONT oFnt1 NAME "Verdana" SIZE 0, -12
DEFINE DIALOG oDlg SIZE 620, 294 FONT oFnt1 TRANSPARENT ;
STYLE nOr( WS_OVERLAPPEDWINDOW ) //COLOR CLR_BLACK,RGB(196,244,244)
oDlg:SetColor(,9425383)
@ 2, 3 FOLDER oFld OF oDlg SIZE 100, 100 PIXEL ;
PROMPTS "Page 1", "Page 2", "Page 3","Page 4","Page 5","Page 6"
@ 2, 3 GROUP oGrp TO 150, 150 PROMPT " Group Text " OF oFld:aDialogs[ 1 ] PIXEL TRANSPARENT;
FONT oFnt
@ 15,10 SAY oSay PROMPT "No" OF oFld:aDialogs[1] PIXEL
@ 13,68 GET oGet1 VAR xVEKNO OF oFld:aDialogs[1] PIXEL RIGHT PICT "@Z 9999999"
@ 15,160 SAY oSay PROMPT "Referans No" OF oFld:aDialogs[1] PIXEL
@ 13,218 GET oGet5 VAR xREFNO OF oFld:aDialogs[1] PIXEL SIZE 60,12
@ 28,10 SAY "Remarks" OF oFld:aDialogs[1] PIXEL
@ 26,68 GET oGet2 VAR xNOTER OF oFld:aDialogs[1] PIXEL SIZE 80,12
@ 100,10 BUTTON obtnChg PROMPT "&Change VEKNO to 99" OF oDlg PIXEL SIZE 100,13 ;
ACTION (xVEKNO:=99, oDlg:Refresh())
//All_Refresh(oDlg))
@ 100,10 BUTTON obtnCancel PROMPT "&Cancel" OF oDlg PIXEL SIZE 50,13 ;
ACTION oDlg:End()
oDlg:bResized := {|| ONINIT_VEKALET(oDlg, oFld, oGrp, obtnCancel, obtnChg) }
ACTIVATE DIALOG oDlg CENTERED ON INIT ONINIT_VEKALET(oDlg, oFld, oGrp, obtnCancel, obtnChg)
oFnt:End()
oFnt1:End()
return nil
function All_Refresh(oDlg)
LOCAL i, o, l, oo, k, ooo
for i:=1 to LEN(oDlg:aControls)
o := oDlg:aControls[i]
If Upper(o:ClassName()) $ "TFOLDER"
for l:=1 to LEN(o:aDialogs)
oo := o:aDialogs[l]
for k:=1 to len(oo:aControls)
ooo := oo:aControls[k]
If !Upper(ooo:ClassName()) $ "TGROUP"
ooo:Refresh()
ENDIF
next k
next l
else
o:Refresh()
endif
next i
return
PROCEDURE ONINIT_VEKALET(oDlg, oFld, oGrp, obtnCancel, obtnChg)
LOCAL i
oFld:nHeight := oDlg:nHeight-80
oFld:nWidth := oDlg:nWidth-29
oFld:Refresh()
oGrp:nHeight := oFld:nHeight-35
oGrp:nWidth := oFld:nWidth-17
obtnChg:nTop := oDlg:nHeight-70
obtnChg:nLeft := oDlg:nWidth-350
obtnCancel:nTop := oDlg:nHeight-70
obtnCancel:nLeft := oDlg:nWidth-125
return[/code:13qee3ub]
.rc file.
[code:13qee3ub]1 24 "WindowsXP.Manifest"[/code:13qee3ub] |
oDlg:Refresh() does not refresh the all component in dialog. | Try after each say and get expression use UPDATE. Then use oDlg:update() rather then oDlg:refresh(). In the asction add .t..It should look like this action(......., odlg:update(),.t.) |
oDlg:Refresh() does not refresh the all component in dialog. | Thank you Harvey,It works. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.