Help please i'm stuck

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Jose Marte
Posts: 12
Joined: Sun Dec 11, 2016 7:52 am
Location: Republica Dominicana

Help please i'm stuck

#1 Post by Jose Marte »

Greetings, for all, if someone could help me with this that I am going to raise, I have a variable type array that filled with several elements after reading from a file, it fills everything well, but does not present values ​​or data once Filled in instructions are as follow.

PRIVATE xUnidad := Space(9)
PRIVATE aArregloUnidad := {" "," "," "," "}

@ 12,32 DCCOMBOBOX xUnidad LIST aArregloUnidad TYPE XBPCOMBO_DROPDOWNLIST SIZE 12,08 FONT '9.Courier' ;
LostFocus {|| DC_GetRefresh(GetList,NIL,DCGETREFRESH_ID_EXCLUDE,NIL) } ;
Valid {|c| ValidarCampo(11,GetList) } When {|| cProvision == "S" }


DBSelectArea("INVFILEH")
Set Order To 1
IF DBSeek(cCodArt)
aArregloUnidad := {InvFileh->RepUn1,IIF(!Empty(InvFileh->RepUni),;
InvFileh->RepUni,Space(9)),IIF(!Empty(InvFileh->RepUns),;
InvFileh->RepUns,Space(9)),IIF(!Empty(InvFileh->RepUnx),InvFileh->RepUnx,Space(9))}
xUnidad := aArregloUnidad[1]


In the instructions I am only showing you those involved in the process that I have explained, please if someone can tell me that I am missing or that I am doing wrong. thanks in advance.

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

Re: Help please i'm stuck

#2 Post by rdonnay »

You are creating a new array pointer, whereas the DCOMBOBOX is bound to the original array pointer.

Array variables are pointers to a location in memory where the array contents can be found.

Even if you give the array variable the same name, it creates a new pointer.

You need to work with the original array pointer.

You can do this as follows:

Code: Select all

DBSelectArea("INVFILEH")
Set Order To 1
IF DBSeek(cCodArt)

  aTemp := {InvFileh->RepUn1,IIF(!Empty(InvFileh->RepUni),;
  InvFileh->RepUni,Space(9)),IIF(!Empty(InvFileh->RepUns),;
  InvFileh->RepUns,Space(9)),IIF(!Empty(InvFileh->RepUnx),InvFileh->RepUnx,Space(9))}

  ASize( aArregloUnidad, 0 )

  FOR i := 1 TO Len(aTemp)
    AAdd( aArregloUnidad, aTemp[i] )
  NEXT

ENDIF
The eXpress train is coming - and it has more cars.

User avatar
Jose Marte
Posts: 12
Joined: Sun Dec 11, 2016 7:52 am
Location: Republica Dominicana

Re: Help please i'm stuck

#3 Post by Jose Marte »

rdonnay wrote:You are creating a new array pointer, whereas the DCOMBOBOX is bound to the original array pointer.

Array variables are pointers to a location in memory where the array contents can be found.

Even if you give the array variable the same name, it creates a new pointer.

You need to work with the original array pointer.

You can do this as follows:

Code: Select all

DBSelectArea("INVFILEH")
Set Order To 1
IF DBSeek(cCodArt)

  aTemp := {InvFileh->RepUn1,IIF(!Empty(InvFileh->RepUni),;
  InvFileh->RepUni,Space(9)),IIF(!Empty(InvFileh->RepUns),;
  InvFileh->RepUns,Space(9)),IIF(!Empty(InvFileh->RepUnx),InvFileh->RepUnx,Space(9))}

  ASize( aArregloUnidad, 0 )

  FOR i := 1 TO Len(aTemp)
    AAdd( aArregloUnidad, aTemp[i] )
  NEXT

ENDIF
Hi, Mr., thanks, but I still have the same difficulty when I get to the unit field that is reading the DCCOMBOX, it appears empty, the arrangement to FixUnit is already filled with the different values, but the field of reading to choose which appears in White.

@ 12,32 DCCOMBOBOX xUnidad LIST aArregloUnidad TYPE XBPCOMBO_DROPDOWNLIST SIZE 12,08 FONT '9.Courier' ;
LostFocus {||DC_GetRefresh(GetList)} Valid {|c| ValidarCampo(11,GetList) } When {|| cProvision == "S" }

User avatar
Jose Marte
Posts: 12
Joined: Sun Dec 11, 2016 7:52 am
Location: Republica Dominicana

Re: Help please i'm stuck

#4 Post by Jose Marte »

rdonnay wrote:You are creating a new array pointer, whereas the DCOMBOBOX is bound to the original array pointer.

Array variables are pointers to a location in memory where the array contents can be found.

Even if you give the array variable the same name, it creates a new pointer.

You need to work with the original array pointer.

You can do this as follows:

Code: Select all

DBSelectArea("INVFILEH")
Set Order To 1
IF DBSeek(cCodArt)

  aTemp := {InvFileh->RepUn1,IIF(!Empty(InvFileh->RepUni),;
  InvFileh->RepUni,Space(9)),IIF(!Empty(InvFileh->RepUns),;
  InvFileh->RepUns,Space(9)),IIF(!Empty(InvFileh->RepUnx),InvFileh->RepUnx,Space(9))}

  ASize( aArregloUnidad, 0 )

  FOR i := 1 TO Len(aTemp)
    AAdd( aArregloUnidad, aTemp[i] )
  NEXT

ENDIF
Hi, Mr., thanks, but I still have the same difficulty when I get to the unit field that is reading the DCCOMBOX, it appears empty, the aArregloUnidad is already filled with the different values, but the field of reading to choose which appears in White.

@ 12,32 DCCOMBOBOX xUnidad LIST aArregloUnidad TYPE XBPCOMBO_DROPDOWNLIST SIZE 12,08 FONT '9.Courier' ;
LostFocus {||DC_GetRefresh(GetList)} Valid {|c| ValidarCampo(11,GetList) } When {|| cProvision == "S" }

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

Re: Help please i'm stuck

#5 Post by rdonnay »

You need a pointer to the combobox object:

@ 12,32 DCCOMBOBOX xUnidad LIST aArregloUnidad TYPE XBPCOMBO_DROPDOWNLIST SIZE 12,08 FONT '9.Courier' ;
LostFocus {|| DC_GetRefresh(GetList,NIL,DCGETREFRESH_ID_EXCLUDE,NIL) } ;
Valid {|c| ValidarCampo(11,GetList) } When {|| cProvision == "S" } ;
OBJECT oComboBox


To refresh the new value of xUnidad: DC_GetRefresh(oComboBox)

Here is another way to update the array: DC_Var2ListBox(oComboBox, aArregioUnidad)

This is simpler than the previous method I showed you.
The eXpress train is coming - and it has more cars.

User avatar
Jose Marte
Posts: 12
Joined: Sun Dec 11, 2016 7:52 am
Location: Republica Dominicana

Re: Help please i'm stuck

#6 Post by Jose Marte »

rdonnay wrote:You need a pointer to the combobox object:

@ 12,32 DCCOMBOBOX xUnidad LIST aArregloUnidad TYPE XBPCOMBO_DROPDOWNLIST SIZE 12,08 FONT '9.Courier' ;
LostFocus {|| DC_GetRefresh(GetList,NIL,DCGETREFRESH_ID_EXCLUDE,NIL) } ;
Valid {|c| ValidarCampo(11,GetList) } When {|| cProvision == "S" } ;
OBJECT oComboBox


To refresh the new value of xUnidad: DC_GetRefresh(oComboBox)

Here is another way to update the array: DC_Var2ListBox(oComboBox, aArregioUnidad)

This is simpler than the previous method I showed you.

Excellent, mr. Thank you, thank you.

Post Reply