Browse List #FIELDS attibute

Hello again.

I am, via template, adding a browse list with a single column/field populated from a local QUEUE variable to a window.
It is a list of reports available to the user.

I have declared the QUEUE in the #LOCALDATA section and I have specified the field in the template control for the list as #FIELDS(ReportQ:Report). (see below)

When I place the template on the window it immediately prompts me for a field to add to the list box formatter. I end up cancelling this and adding #FIELDS(ReportQ:Report) to the LIST declaration in the Window text editor.

I can work with it as it is, but I’d like to resolve it if possible.

Is there a way I can get it to keep the field I have specified in the template? What have I missed?

 CONTROLS
   LIST,AT(,,259,300),USE(?ListReportQ),VSCROLL,ALRT(MouseLeft2),FORMAT('200L(1)~Available Reports~@s80@'),|
     FROM(ReportQ),#SEQ(1),#FIELDS(ReportQ:Report),#ORIG(?ListReportQ)
   BUTTON('Print'),AT(,105,72,26),USE(?PrintButton),RIGHT,FONT('Verdana',,,FONT:Regular,CHARSET:ANSI),|
     ICON('.\icons\printer.ico'),#ORIG(?PrintButton),DISABLE
   PROMPT('Report Description'),AT(,,180,26),USE(?DescriptionPrompt),#ORIG(?DescriptionPrompt)
 END

Thanks.

We’d have to see your template code. I suspect the problem is related to the INSTANCE of your template code.

When you add a template to a procedure the template code has a unique INSTANCE assigned to it, so if you add it twice the code in your template can differentiate between the two instances of your code/control.

So, your template code has to refer to %ActiveInstance for the control, otherwise it won’t know which control you are referring to.

Only allowing a single instance per procedure, but here it is…the declaration bits. The rest of it is boilerplate stuff.
Populating the controls on/in the window drops the #FIELDS attribute of the list…?

#CONTROL (ReportMenu, 'Report Menu'), WINDOW
#LOCALDATA
ReportQ            QUEUE,PRE(ReportQ)
Report               STRING(80)
Description          STRING(255)
                   END
#ENDLOCALDATA
      CONTROLS
        LIST,AT(,,259,300),USE(?ListReportQ),VSCROLL,ALRT(MouseLeft2),FORMAT('200L(1)~Available Reports~@s80@'),|
          FROM(ReportQ),#SEQ(1),#FIELDS(ReportQ:Report),#ORIG(?ListReportQ)
        BUTTON('Print'),AT(,105,72,26),USE(?PrintButton),RIGHT,FONT('Verdana',,,FONT:Regular,CHARSET:ANSI),|
          ICON('.\icons\printer.ico'),#ORIG(?PrintButton),DISABLE
        PROMPT('Report Description'),AT(,,180,26),USE(?DescriptionPrompt),#ORIG(?DescriptionPrompt)
      END
#BUTTON('Reports'),MULTI(%AvailableReports,%ReportName & '  -  ' & %ReportProcedure),INLINE
  #PROMPT('Display Name:',      @s80) ,%ReportName,       AT(75,,130),REQ
  #PROMPT('Report Procedure:',  @s255),%ReportProcedure,  AT(75,,130),REQ
  #PROMPT('Display Condition:', @s255),%ReportCondition,  AT(75,,130)
  #PROMPT('Description:',       @s255),%ReportDescription,AT(75,,130)
#ENDBUTTON
#BOXED('Embeds')
  #PROMPT('Before Loading the ReportQ',      EMBEDBUTTON(%BeforeLoadingReportQ)),     AT(,,173)
  #PROMPT('After Loading the ReportQ',       EMBEDBUTTON(%AfterLoadingReportQ)),      AT(,,173)
  #PROMPT('End of ReportQ CASE statement',   EMBEDBUTTON(%EndOfReportQCASEbeforeEND)),AT(,,173)
#ENDBOXED
#AT (%DataSectionBeforeWindow)
SelectedReport         LONG
#ENDAT

Cheers.

Get rid of the #SEQ and #ORIG entries in your template. The IDE will add these automatically when you populate the control template.
I tweaked your template and removed them and it worked for me.

HTH,
Rick

What else did you tweak - doesn’t for me?

  CONTROLS
    LIST,AT(,,259,300),USE(?ListReportQ),VSCROLL,ALRT(MouseLeft2),FORMAT('200L(1)~Available Reports~@s80@'),|
      FROM(ReportQ),#FIELDS(ReportQ:Report)
    BUTTON('Print'),AT(,105,72,26),USE(?PrintButton),RIGHT,FONT('Verdana',,,FONT:Regular,CHARSET:ANSI),|
      ICON('.\icons\printer.ico'),DISABLE
    PROMPT('Report Description'),AT(,,180,26),USE(?DescriptionPrompt)
  END

I still get this popping up when I put the control template on the window:

(BTW, still using old, old C5.5)
Cheers.

Not much else. Here’s the template I’m using. This is in Clarion 10.0.11897

#!------------------------------------------------------------------------------------------------------
#CONTROL (ReportMenu, 'Report Menu'), WINDOW
#LOCALDATA
ReportQ            QUEUE,PRE(ReportQ)
Report               STRING(80)
Description          STRING(255)
                   END
#ENDLOCALDATA
      CONTROLS
        LIST,AT(,,259,300),USE(?ListReportQ),VSCROLL,ALRT(MouseLeft2),FORMAT('200L(1)~Available Reports~@s80@'),|
          FROM(ReportQ),#FIELDS(ReportQ:Report)
        BUTTON('Print'),AT(,105,72,26),USE(?PrintButton),RIGHT,FONT('Verdana',,,FONT:Regular,CHARSET:ANSI),|
          ICON('.\icons\printer.ico'),DISABLE
        PROMPT('Report Description'),AT(,,180,26),USE(?DescriptionPrompt)
      END
#BUTTON('Reports'),MULTI(%AvailableReports,%ReportName & '  -  ' & %ReportProcedure),INLINE
  #PROMPT('Display Name:',      @s80) ,%ReportName,       AT(75,,130),REQ
  #PROMPT('Report Procedure:',  @s255),%ReportProcedure,  AT(75,,130),REQ
  #PROMPT('Display Condition:', @s255),%ReportCondition,  AT(75,,130)
  #PROMPT('Description:',       @s255),%ReportDescription,AT(75,,130)
#ENDBUTTON
#BOXED('Embeds')
  #PROMPT('Before Loading the ReportQ',      EMBEDBUTTON(%BeforeLoadingReportQ)),     AT(,,173)
  #PROMPT('After Loading the ReportQ',       EMBEDBUTTON(%AfterLoadingReportQ)),      AT(,,173)
  #PROMPT('End of ReportQ CASE statement',   EMBEDBUTTON(%EndOfReportQCASEbeforeEND)),AT(,,173)
#ENDBOXED
#AT (%DataSectionBeforeWindow)
SelectedReport         LONG
#ENDAT

Screen shot of the window after dropping the template:

Screen shot of the list formatter:

and of the “Text” version of the window. Note the #SEQ and #ORIG values have been added.

Sorry, didn’t see your C5.5 comment until just now.
That might be part of the problem.
I don’t have a C5.5 installation around anymore to test.

Looking like it might be. Just tried it on a C6 install too and same issue.

Guess I will have to put up with it for a while…

Thanks very much for your help.

Give one other thing a try.
Move the #LOCALDATA code to after the CONTROL and template prompts. Put it just before the first #AT. The examples I have are all that way.
Worth a shot.

Rick

Same result. I put #LOCALDATA first as the list ‘depended’ on it.

Not fluent in template so not entirely sure of the process or order it does things in.

Never mind - will have to make a mental note that this is what it does.

Thanks again.