Use of macro in browser creation

This forum is for eXpress++ general support.
Post Reply
Message
Author
Janko
Posts: 111
Joined: Sat Mar 20, 2010 8:36 am
Location: Cerklje

Use of macro in browser creation

#1 Post by Janko »

Dear Roger,

I use huge database containing different kinds of monthly data. All fields are named as 'koli01', 'koli02' ....'koli12', or 'neto01', 'neto02',....'neto12'.

I tried to replace extensive and repeating 'DCBROWSECOL ....' with macro operator:

Code: Select all

@ 3,1 DCBROWSE oBrowse ALIAS 'MATERI'                       ;
      SIZE 140 , 31  SCOPE   FREEZELEFT {1}                   ;
      PRESENTATION aPres

DCBROWSECOL FIELD MATERI->NAZIV ;
  HEADER "MATERIAL" PARENT oBrowse FOOTER '1'  EVAL { |o| o:colorBlock := dColor };
  SORT bSortCol      WIDTH 20

 FOR i:=12 to 1 STEP -1
		m->cVar:='MATERI->skoli'+StrZero(i,2)
    DCBROWSECOL DATA {||  &(m->cVar)}  ;
    HEADER "Količina "+aMes[i] PARENT oBrowse FOOTER StrZero(i,2)   WIDTH 10   PRESENTATION  bPres  PICTURE pic1
 NEXT i
but after forming GetList, GetSet block for a column created with macro (see: GetList [ ,31,1]) is containing uncompiled macro: {{ || &(m->cVar)}, .....} and oBrowse is showing column corresponding to last cVar.

Is there a way to avoid this?

Best regards
JAnko

skiman
Posts: 1199
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Use of macro in browser creation

#2 Post by skiman »

Hi,

The following should work.

Code: Select all

FOR i:=12 to 1 STEP -1
    bBlock := &("{|| MATERI->skoli"+StrZero(i,2)+"}")
    DCBROWSECOL DATA bBlock  ;
    HEADER "Količina "+aMes[i] PARENT oBrowse FOOTER StrZero(i,2)   WIDTH 10   PRESENTATION  bPres  PICTURE pic1
NEXT i
Hope this helps. This way the codeblock is made within the For/next and with the correct value of i. In your code the value of i is always the last value.
Best regards,

Chris.
www.aboservice.be

Janko
Posts: 111
Joined: Sat Mar 20, 2010 8:36 am
Location: Cerklje

Re: Use of macro in browser creation

#3 Post by Janko »

Chris,

yes, it works. Thank you, best regards
Janko

Post Reply