DCBROWSE field definitions in array

This forum is for eXpress++ general support.
Post Reply
Message
Author
Victorio
Posts: 622
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

DCBROWSE field definitions in array

#1 Post by Victorio »

Hi,
Please,how I can make this ?
I have in Clipper source field and header definitions in arrays, in eXpress I can only use headers, but fields break with error.

My source here:
SELECT 1
use datax index datax

* prku is names of database fields
* hrku is names of header columns

PUBLIC prku[3],hrku[3]
*DECLARE prku[3],hrku[3]

prku[1]="POR"
prku[2]="N_KATUZ"
prku[3]="K_KATUZ"

hrku[1]="Por.č."
hrku[2]="Názov k.ú."
hrku[3]="Kód k.ú."

@ 1,1 DCBROWSE oBrowse ;
SIZE 77,11.8 ;
CURSORMODE XBPBRW_CURSOR_ROW ;
ITEMSELECTED {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}

DCBROWSECOL FIELD 1->POR ;
HEADER hrku[1] PARENT oBrowse

DCBROWSECOL FIELD 1->N_KATUZ ;
HEADER hrku[2] PARENT oBrowse

etc...

but I Want write some like this (in CA Clipper it run normally)

DCBROWSECOL FIELD 1->prku[1] ;
HEADER hrku[1] PARENT oBrowse

DCBROWSECOL FIELD 1->prku[2] ;
HEADER hrku[2] PARENT oBrowse

etc...

error is BASE/8027 Unknown symbor for database field...
I tryed @, &, before array name, but same error...

messaoudlazhar
Posts: 42
Joined: Mon Dec 23, 2013 2:10 pm
Contact:

Re: DCBROWSE field definitions in array

#2 Post by messaoudlazhar »

Hi,
Trying to use the following syntax :

DCBROWSECOL DATA {|| prku[1]}
HEADER hrku[1] PARENT oBrowse

Best regards,
Messaoud Mohamed Lazhar

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

Re: DCBROWSE field definitions in array

#3 Post by skiman »

You also need to use the ALIAS parameter of dcbrowse.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4733
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCBROWSE field definitions in array

#4 Post by rdonnay »

The below code is a sample program that will show you how to use array definitions for browsing a database.
Compile and run the program to see how it works.

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL GetList[0], GetOptions, oBrowse, aFields, i, cAlias

USE \exp19\data\Xtest
cAlias := Alias()

aFields := XTEST->(dbStruct())

@ 1,0 DCBROWSE oBrowse ALIAS cAlias SIZE 100, 20 ;
      PRESENTATION DC_BrowPres() ;
      FONT '9.Lucida Console'

FOR i := 1 TO Len(aFields)
  DCBROWSECOL DATA DC_FieldWBlock(aFields[i,1],cAlias) ;
    PARENT oBrowse HEADER aFields[i,1]
NEXT

DCREAD GUI FIT TITLE 'Browsing Database'

RETURN nil

PROC appsys ; RETURN
The eXpress train is coming - and it has more cars.

Victorio
Posts: 622
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DCBROWSE field definitions in array

#5 Post by Victorio »

Thanks ,
this running fine :

DCBROWSECOL DATA DC_FieldWBlock(pic[1],"1") WIDTH 10;
HEADER hic[1] PARENT oBrowse
where "1" is my "alias" of table, because I am using SELECT 1, SELECT 2,... numbers are aliases.

I do not like write names of field and headers anywhere, but I have it in header of function, where I have it on one place and with several function for example :
piv[1]="KN_PCS"
piv[2]="tucpopis(KN_TUC)"
piv[3]="substr(KN_VLA,1,50)"
...

Roger, I do not want browse every fields from table (table has many fields, but user do not need view all), I want browse only several important fields which user can see in one of dialogs.

User avatar
rdonnay
Site Admin
Posts: 4733
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCBROWSE field definitions in array

#6 Post by rdonnay »

Roger, I do not want browse every fields from table (table has many fields, but user do not need view all), I want browse only several important fields which user can see in one of dialogs.
It will only browse those which are in the array.
The eXpress train is coming - and it has more cars.

Zdeno Bielik
Posts: 147
Joined: Thu Jan 28, 2010 9:24 am
Location: Nitra, Slovakia
Contact:

Re: DCBROWSE field definitions in array

#7 Post by Zdeno Bielik »

Hi,

in one of the messages that I sent to your private e-mail in last weeks, also includes such examples
just carefully see attached examples there and try play with examples in demo and in eXpress’s help


aBrowse := { ;
{ 'PSČ', { || OBCE->PSC } }, ;
{ 'Obec', { || OBCE->OBEC } }, ;
{ 'Okres', { || OBCE->OKRES } }, ;
{ 'Kraj', { || OBCE->KRAJ } } ;

nMax := Len( aBrowse )

For ix := 1 To nMax
DCBROWSECOL DATA aBrowse[ ix, 2 ] HEADER aBrowse[ ix, 1 ] PARENT oBrowse
Next


Zdeno

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: DCBROWSE field definitions in array

#8 Post by Eugene Lutsenko »

Or maybe choose a array of information only those fields that you want to display?

Post Reply