Enumerating Fields in a GROUP or QUEUE - How do you know you've reached the end?

I wrote a testbed to show that Jeff’s information is correct.

  PROGRAM
  MAP
  END

Q1 QUEUE
Str  &CSTRING
   END

Q2 QUEUE
Str &CSTRING
   END 

What:String4 STRING(4)
What:Long    LONG,OVER(What:String4)

  CODE
  ! Show it's too early for this work, as Q1.Str is NULL
  What:String4   = WHAT(Q1, 1)
  Q2.Str        &= What:Long + 0 

  Q1.STR   &= NEW CSTRING(42)
  Q1.STR    = 'Hi Dennis'
  DO ShowValues

  ! now set Q2.Str to the referenc in Q1.Str
  What:String4 = WHAT(Q1, 1)
  Q2.Str      &= What:Long + 0 ! + 0 turns this into an expression, so it's an address
  DO ShowValues

  Q1.STR = 'New Value'
  DO ShowValues

           !         1         2         3         4
           !123456789-123456789-123456789-123456789-123456789-
  Q1.STR = 'This is a longer value than the orig, and > 42'
  DO ShowValues

ShowValues ROUTINE
  MESSAGE('Q1.Str  ['& Q1.Str &']' |
       & '|Q2.Field['& Q2.Str &']' |
         )

Cool, Mark. Glad it’s making sense.

Don’t forget to DISPOSE() before you go to production. :slight_smile:

Hi guys,

Bit late to the party, but stumbled on this code as I’m working on some generic code for GROUPs. Didn’t see a list of what the GetAnyDataType() function returns, i.e. the numeric value for the various data types. This is what I got:

BYTE                  1
SHORT                 2
USHORT                3
DATE                  4
TIME                  5
LONG                  6
SIGNED                6
UNSIGNED              6
SIGNED                6
ULONG                 7
REAL                  9
DECIMAL(10,2)        10
PDECIMAL(10,2)       11
BFLOAT4              13
BFLOAT8              14
STRING(10)           18
GROUP                18
CSTRING(10)          19
PSTRING(10)          20

Might help.

Best regards,
Arnor

Hi Arnor -

Look for “DataType” in equates.clw.

Hi Jeff,

Hah! Never noticed that one!!! Good to know :slight_smile:

Best regards,

Hi Arnor - I use that stuff in my “private” class https://github.com/jslarve/PrivateClass/blob/master/JSPrivateClass.clw

A “reference” data type returns 31 and is treated special.

Hmm, the value of 31 is new to me.
Can that be used to correctly work with WHAT( Grp, N ) ?

FWIW, I have a similar method, Debuger.DescribeDataType (around line 1290 in —v )

Hi Mark - I thought we discussed the “31” thing privately. Looking at line 1313, it looks like you had also discovered that at one point. :slight_smile: https://github.com/MarkGoldberg/ClarionCommunity/blob/master/CW/Shared/Src/debuger.clw#L1313

That’s pretty funny - (blush)

You’re in good company, Mark :slight_smile:

@hdsoftware (Ole Morten Heien) just pointed out that the CLType equates found in SV’s shipping XMLTypes.inc match up to the DataType: equates found in equates.clw

What’s interesting to me is CLType:Reference EQUATE(31) AND several more data types yet.

1 Like

Interesting. Thank you Mark.

So that begs the question, where is XMLType.clw?

Its in the LibSrc folder. At least its in mine. Maybe this is limited to Enterprice edition… That I dont know

Note, inc not clw and it should be in both:

I have EE, but there’s no XMLType.clw anywhere on my machine.

fwiw, in C6 (which is all I have), it’s called xmlTypeInfo.inc and it’s in LibSrc

I am late to this conversation but as far as I can see XMLType.clw is not provided to us but it is compiled in to Claxmlty.dll in the bin directory.