PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → storing Automtic 4 byte ID's in a memo field
storing Automtic 4 byte ID's in a memo field
Iniciado por guest, 26,ene. 2018 22:18 - 4 respuestas
Publicado el 26,enero 2018 - 22: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?
Publicado el 27,enero 2018 - 07:44
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
Publicado el 27,enero 2018 - 14:45
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
Publicado el 27,enero 2018 - 16:46
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
Publicado el 27,enero 2018 - 19:10
Hi Garry,

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

Best regards