Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
13
Erster Beitrag:
vor 9 Jahren, 7 Monaten
Letzter Beitrag:
vor 9 Monaten, 2 Wochen
Beteiligte Autoren:
Rich, Randall, Art Bonds, DerekT, DarrenF

Retrieving CROSSED Records

Startbeitrag von Rich am 27.04.2008 17:51

I could find nothing in help about retrieving records crossed with HCross.

I would like to start using HCross but unless the crossed records can be reinstated it is not of much use.

Antworten:

Looking at the Help, I see a number of ways Crossed records can be reclaimed. Reading all records and looking at HState, re-enabling by HModify or HWrite, HNbRec to find out the number of crossed records.

What are you specifically trying to do? A scenario maybe...

von Art Bonds - am 27.04.2008 19:59
Art,

I want to offer the user the ability to reclaim records, so I want to cross them instead of deleting them.

I want to have a table that shows the crossed records and allow the user to click on one to re-activate it.

Since, as I understand it there is no way to show the crossed records in a table, I don't know how to do this.


von Rich - am 27.04.2008 20:49
Haven't tried this yet, but here is what I would do.

Create a button on the table that shows your file.

Upon click of that button...

Open a memory table (in this code named MTableCrossedRecords). In the initialization code place the following:

i is int
For i = 1 to HnbRec(FileName,hStateAll)
...HRead(FileName)
...If HState() = hStateCrossed Then
......hTableAdd(MTableCrossedRecords)
...End
End

Don't know if you'll have to open FileName or not... IIRC any file access open the file, but if you don't get any records I'd put in some error checking.

I think you should be able to scroll this memory table just like you do a regular file loaded browse table. I'd turn on multiselect so the user can select several records at once. Then on the memory table have a button that does this code...

For Each Selected Row of MTableCrossedRecords
...HModify(FileName)
End

Look at the warning regarding a multi-user application under "HState - Record number not specified". Not sure if it would be applicable... I think if you didn't find it then somebody either restored it already or actually deleted the record just after you loaded it.






von Art Bonds - am 28.04.2008 13:33
Art,

I will try this and see what happens.

von Rich - am 28.04.2008 14:35
Art,

Works like a charm.

I am continually being awed with the capabilities of WinDev, and the willingness of particpants in this group to give of their time to help others. :spos:

von Rich - am 28.04.2008 16:10
How is this done? I opened another thread http://27130.foren.mysnip.de/read.php?27131,777080,777080#msg-777080 to try and get some understanding of what a "memory table" is (mentioned by Art above, and understood by some others according to the post I referenced), but nobody has responded.

I don't know... but it appears to be something different from an ordinary table. It looks like it's integral to setting something up to retrieve crossed records. Would someone explain, or show me an example of a "memory table"... or how I could retrieve crossed records from a user interface please?

Thanks in advance for any help on this!

von Randall - am 09.02.2017 15:04
Hey Randall,

...and in the example link you posted (http://doc.pcsoft.fr/en-US/?1013148), did you take a look at any of the unit or training examples listed therein? There's a memory table unit example for each of the WX products.

von DarrenF - am 09.02.2017 23:23
Yes, thank you Darren... it starts out

"Initializing a memory Table control"
"The creation of a row in a Table control is not automatically performed."

... and goes on from there explaining how to add or modify a row. Ok, but... add add rows to what? I'm supposed to simply add rows to a non-existant table then viola it exists? I'm familiar with adding rows to a table newly added to the scm to get it to show up in the Control Center. Otherwise, yeah sorry... I don't get it!

von Randall - am 10.02.2017 13:00
Randall

A 'table' is a control - therefore must be (visible or not) on a window.

In the window 'content' tab if the 'Source browsed:' is a file/query then you have a browsing table.
If it is By Programming or By Variable then you have a memory table.

If it is the latter then you have a multitude of choices on how you populate and display the data.
All will depend on how you get the data and what you do with it before displaying.

Need more detail on what you have and need to achieve.

von DerekT - am 10.02.2017 14:49
Hi Derek... thanks, I didn't realize the distinction. I've added table rows both ways... but how would Columns/Fields be added dynamically, depending on the table? I'm trying to do a generic version of what Art mentioned above... which I pasted below.

Open a memory table (in this code named MTableCrossedRecords). In the initialization code place the following:

i is int
For i = 1 to HnbRec(FileName,hStateAll)
...HRead(FileName)
...If HState() = hStateCrossed Then
......hTableAdd(MTableCrossedRecords)
...End
End

Don't know if you'll have to open FileName or not... IIRC any file access open the file, but if you don't get any records I'd put in some error checking.

I think you should be able to scroll this memory table just like you do a regular file loaded browse table. I'd turn on multiselect so the user can select several records at once. Then on the memory table have a button that does this code...

For Each Selected Row of MTableCrossedRecords
...HModify(FileName)
End

von Randall - am 10.02.2017 15:16
Randall

I do not believe you can make a generic version.....

BuildBrowsingTable(MyTable,"Customer") will create a table containing fields of the named table - check the Help for the options available.
But aesthetically they are not great and you cannot set all options that a standard control has.

The main issue is filling the table.
TableAddLine() requires that the value for each required column is entered......
FOR  i = 1 TO HNbRec("Customer",hStateAll)
SWITCH HState("Customer", i)
CASE hStateActive
//Do your stuff here
CASE hStateCrossed
TableAddLine(tblCust,Customer.LastName,Customer.Address) //etc etc
CASE hStateDel
//Do your stuff here
END
END


Using TableAddLine(MyTable,Customer) will not work

von DerekT - am 10.02.2017 17:47
I was hoping BuildBrowsingTable was available for WebDev, but it isn't.
Idk, maybe this could work for WinDev using a button to refresh a table.

i is int = 0
gsTabName = NoSpace(EDT_TabName..DisplayedValue)
gsConnection = NoSpace(COMBO_Connection..DisplayedValue)
IF HChangeConnection({gsTabName},{gsConnection}) = True THEN
...BuildBrowsingTable(TABLE_GenTab,{gsTabName})
...sRowCSV is string = ""
...sTabField is string = ""
...sTabFields is string = HListItem({gsTabName})
...FOR i = 1 _TO_ HNbRec({gsTabName},hStateAll)
......HRead({gsTabName})
......IF HState() = hStateCrossed THEN
.........sRowCSV = HRecNum({gsTabName}) //TABLE_GenTab.COL_RecNo
.........FOR EACH STRING sTabField OF sTabFields SEPARATED BY CR
............sRowCSV += ","+ {gsTabName +"."+ sTabField}
..........END
..........TableAddLine(TABLE_GenTab,sRowCSV)
......END
...END
END

Then have a separate button to un-cross them.
xRecs is numeric = 0
IF {gsTabName}..Connection = gsConnection
...FOR EACH SELECTED ROW OF TABLE_GenTab
......IF HRead({gsTabName},TABLE_GenTab.COL_RecNo) = True THEN
.........HModify({gsTabName})
.........xRecs ++
......END
...END
END
Info("UnCrossed "+ NumToString(xRecs) +" Records.")

von Randall - am 10.02.2017 19:49
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.