For Programmers: Free Programming Magazines  


Home > Archive > Clarion > June 2005 > urgent set fails on multipart alpha key with clear but works on single part alpha key









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author urgent set fails on multipart alpha key with clear but works on single part alpha key
john@readysell.com.au

2005-06-03, 3:55 am

hi,

I have a problem using set on a multi part key that can be reproduced
with topscan. To get around this I have to define extra single part
alpha keys just to make set work!

I have a table with multi part alpha and numberic keys. If I do a clear
and set on the numeric keys it always works, if I do a set on an key
that starts with an alpha with additional numeric components it does
not work.

This is not a problem with not using clear().

1. Table structure

atable
key1 (atable.astring,atable.along)
key2 (atable.astring)
key2 (atable.along,atable.ashort)
astring cstring (11)
along long
ashort short

2. Data
astring along asort
A 1 1
B 2 2
C 3 3

3. Test

3.1 Set on alpha fails
Clear(atable:record)
atable.astring = 'B'
set(atable:key1,atable.key1)
next(atable)
message('atabel.astring) ! displays 'C'. Should display B!!!!!

3.2 Set on key just containing the string works
Clear(atable:record)
atable.astring = 'B'
set(atable:key2,atable.key2)
next(atable)
message('atabel.astring) ! displays 'B'. works!

JMumf

2005-06-03, 3:55 am

The following worked for me:

ATable
FILE,DRIVER('TOPSPEED'),PRE(ATable),CREA
TE,BINDABLE,THREAD
Key1
KEY(ATable:AString,ATable:ALong),DUP,NOC
ASE,OPT
Key2 KEY(ATable:ALong),DUP,NOCASE,OPT
Key3
KEY(ATable:AString,ATable:AShort),DUP,NO
CASE,OPT
Record RECORD,PRE()
AString CSTRING(11)
ALong LONG
AShort SHORT
END
END

CLEAR(ATable:Record)
ATable:AString='B'
SET(ATable:Key1,ATable:Key1)
NEXT(ATable)
Message(ATable:AString)

This displayed 'B' as it should.

Using same values as your example.

C6.1

Also tried:

ATable
FILE,DRIVER('TOPSPEED'),PRE(ATable),CREA
TE,BINDABLE,THREAD
Key1 KEY(ATable:AString,ATable:ALong)
Key2 KEY(ATable:ALong)
Key3 KEY(ATable:AString,ATable:AShort)
Record RECORD,PRE()
AString CSTRING(11)
ALong LONG
AShort SHORT
END
END

Same results

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com