Create dynamic temp-table with case-sensitive CHARACTER fiel

Posted by Mark Davies on 24-Jul-2015 05:26

Hi all,


OE11.2, any OS.

I know it is possible to define a static temp-table with a character field that is set to be CASE-SENSITIVE, but I do not see an option to create a field on a dynamic temp-table with a case sensitive character field. There is an attribute on the buffer field object, but that is read-only (which makes sense), but how would I be able to mark my field as case sensitive before I prepare my temp-table?

TIA

All Replies

Posted by Simon L. Prinsloo on 24-Jul-2015 06:12

It seems that it cannot be done directly, but here is a workaround, although it fattens up the r-code with a dead temp-table...:

DEFINE VARIABLE hT AS HANDLE NO-UNDO.

DEFINE TEMP-TABLE ttTemplate NO-UNDO
  FIELD caseSensitive AS CHARACTER CASE-SENSITIVE
  FIELD notCaseSensitive AS CHARACTER NOT CASE-SENSITIVE
  .

CREATE TEMP-TABLE hT.
hT:ADD-LIKE-FIELD ("myCSString","ttTemplate.caseSensitive").
hT:ADD-LIKE-FIELD ("myCIString",BUFFER ttTemplate:BUFFER-FIELD ("notCaseSensitive")).

hT:TEMP-TABLE-PREPARE("myTable").

MESSAGE 
  hT:DEFAULT-BUFFER-HANDLE:BUFFER-FIELD ("myCSString"):CASE-SENSITIVE SKIP
  hT:DEFAULT-BUFFER-HANDLE:BUFFER-FIELD ("myCIString"):CASE-SENSITIVE
VIEW-AS ALERT-BOX.

This thread is closed