Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 6 Monaten, 3 Wochen
Letzter Beitrag:
vor 6 Monaten, 3 Wochen
Beteiligte Autoren:
Garry Allen, Fabrice Harari, Al

storing Automtic 4 byte ID's in a memo field

Startbeitrag von Garry Allen am 26.01.2018 21:18

Here is another easy one for you WinDev22 gurus;
I have a data file Cust_Order_Template with 2 fields
CustID - numeric, 4 Bytes
ItemList - binary
I want to store a number of 4 byte Item IDs in the ItemList field and later retrieve them into an array so that I can do an HReadSeekFirst on each in the Item file to retrieve additional info..
The problem is that I can't seem to find the correct syntax to successfully do this.
Should I be using some form of serialize?
Any ideas?

Antworten:

Hello Garry

As an alternative, you could use a link file comprised of two CustID and ItemID.
Much easier to work with, faster and also would allow reverse look up from ItemId to CustID
I would also suggest moving to 8 byte fields.

Regards
Al

von Al - am 27.01.2018 06:44
Hi Gary,

you can simply do:
ID1+CR+id2+CR+id3+CR...

You can then work directly n that stirng (extractstring+index) or transfer it first into an array if yo prefer

Best regards

von Fabrice Harari - am 27.01.2018 13:45
What a wonderful thing sleep is! I spent a couple of hours on this yesterday and got nowhere. This morning I got up and wrote the whole thing in 10 minutes,
Never the less, thanks for your input.

Fabrice: that was my first approach but then I got worried about ID1, ID2,etc being strings and the fields are numeric (of course I had just finished reading your Best Practices!)

Al: that would seem to be the obvious solution but for some reason I had decided that I only wanted one record per customer. However, your point about reverse lookup deserves consideration.
Garry

von Garry Allen - am 27.01.2018 15:46
Hi Garry,

yes, you do store numerics in a string in that case... that is what numtostring and val functions are for... :-)

Best regards

von Fabrice Harari - am 27.01.2018 18:10
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.