PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Extract glink value from combobox
Extract glink value from combobox
Iniciado por Al, 21,nov. 2007 09:39 - 5 respuestas
Publicado el 21,noviembre 2007 - 09:39
G'day All

How do you extract a glink value from a manually filled combox box when it is in a table ?

The code I normally use when a combobox is in a window does not work when the combobox is in a table and is manually filled

>

This code is in the init of the comboxbox

HReadFirst(EstRef,E3Cleunik)

WHILE NOT HOut(EstRef)

  ListAdd(LB_Task,EstRef.ErefNumber+TAB+EstRef.Description + gLink(NumToString(EstRef.EFCLEUNIK,"10d")))

  HReadNext(EstRef,E3CLEUNIK)

END

ListSelectPlus(LB_Task,1)

In the exit of the combobox I would normally use ..storedvalue to extract the glink value but that is not allowed for a combobox in a table

GLinkActivate(LB_task)

x = lb_task..storedvalue



I have tried using the Glink option in the combobox definition but that makes no difference.

The help on ..stored value has a specific example for a combobox but that does not work for a manually filled combobox when it is in a table.

Also how do you extract the selected row number, the normal method

RowNumber = combobox does not work



Does anyone have any suggestions ?

Regards

Al
Publicado el 21,noviembre 2007 - 10:13
Hello Al,

>How do you extract a glink value from a manually filled combox box when it is in a table ?

LB_Task.Columnname[TableRow]

Also how do you extract the selected row number, the normal method


>RowNumber = combobox does not work

ListSeek(LB_Task.Columnname,LB_Task.Columnname[TabelRow])

Kind regards,

Louis.
Publicado el 21,noviembre 2007 - 12:16
G'day Louis

I am not sure how to use what you have sent me

>>How do you extract a glink value from a manually filled combox box when it is in a table ?

LB_Task.Columnname[TableRow]


>>Also how do you extract the selected row number, the normal method

RowNumber = combobox does not work


>ListSeek(LB_Task.Columnname,LB_Task.Columnname[TabelRow])



I don't know what the row number is or any values in the combobox. The situation is that I have manually filled a combobox in a table with displayed items plus a glink value which represents the primary key.

When the user clicks on a row I want to extract the glink value from the currently selected row.

For a combobox on a window I would use the following exit code

RowNum = MySelf

gLinkActivate(MySelf,True)

X = MySelf[RowNum]..StoredValue

None of this code works when the combobox is in a table

The rownum is always zero and when I try and get the stored value, the error message is :

"The StoredValue property does not apply to control. Control Type: Table Cell."



Regards

Al
Publicado el 21,noviembre 2007 - 12:46
>G'day Louis

I am not sure how to use what you have sent me


>>>How do you extract a glink value from a manually filled combox box when it is in a table ?

LB_Task.Columnname[TableRow]


>>>Also how do you extract the selected row number, the normal method

RowNumber = combobox does not work


>>ListSeek(LB_Task.Columnname,LB_Task.Columnname[TabelRow])



TableRow gives the active row of table.

So Columnname[TableRow] should give the storedvalue of the column. In the details-tab of that column you need to specify 'Returns the value spoecified by gLink'.

>I don't know what the row number is or any values in the combobox. The situation is that I have manually filled a combobox in a table with displayed items plus a glink value which represents the primary key.

With ListSeek you can find the rownumber of the selected item in the combobox.

Kind regards,

Louis.
Publicado el 21,noviembre 2007 - 13:49
G'day Louis

It doesn't seem to matter if the glink attribute is ticked on not the value is always blank.

This is the code in the column init

>

ListDeleteAll(MySelf)

GComboDefault = 1 //default selection row

//add a blank entry

ListAdd(MySelf,"Other Task"+gLink("0"))

//set filter and fill the combobox

HFilter(EstRef,E3CLEUNIK,BU_Table.BU_E3CLEUNIK)

HReadFirst(EstRef)

WHILE NOT HOut(EstRef)

   ListAdd(LB_Task,EstRef.Description + gLink(NumToString(EstRef.EFCLEUNIK,"10d")))

  IF EstRef.EFCLEUNIK = LAB_Table.LB_EFCLEUNIK THEN

     GComboDefault = ListCount(MySelf)

  END

  HReadNext(EstRef,E3CLEUNIK)

END

HDeactivateFilter(EstRef)

//Select a row

ListSelectPlus(LB_Task,GComboDefault)

gLinkActivate(MySelf,True)

//store the current value in an adjacent column in the sametable

//this is always blank

LAB_Table.LB_EFCLEUNIK = LB_Task[GComboDefault]



//This is the column exit code

gLinkActivate(MySelf,True)

//get the row - this does return the row number ok

LSubscript =ListSelect(MySelf)

//this is always blank, I am expecting the glink value

LAB_Table.LB_EFCLEUNIK = MySelf[LUPSubscript]

//MySelf[LUPSubscript]..storedvalue gives an error as previously indicated

Where is the Glink value hiding ?



The "myself" variable always returns a string containing the data from the original listadd() routine.

Changing the combobox from editable to non editable just changes the value returned in the "myself" variable from subscript to text string

It seems impossible to extract the glink value from a combobox in a table.

I have resorted to adding the primary key at the end of the text and am extracting it from the end of the string so it works but...

Thanks for your help.

Regards

Al
Publicado el 11,abril 2021 - 11:37
Hello,
I am facing the same issue. Did you find any better solution?
Now I will try to experiment with combo box inserted in container in table column, it should give me more properties then standard combo control in column.

Petr