Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
19
Erster Beitrag:
vor 4 Jahren, 8 Monaten
Letzter Beitrag:
vor 4 Jahren, 8 Monaten
Beteiligte Autoren:
Randall, Piet van Zanten, Allard

Combo in Table

Startbeitrag von Randall am 31.07.2013 16:26

I changed the table column type to List of Values and added code in the Init of the table to populate table_name.col_name..content with an Array but could not get anything to display... not even a Blank selection. I just got Not Defined errors. I checked through the Forum here, and found there may be more difficulty ahead trying to use a different table to populate the Combo and having the Combo contents disappear when selecting different rows of the Table. Would someone please explain, or show by example how a Combo can be displayed and used in a table column?

Thanks in advance for any help on this...

Antworten:

Hi webdev or windev? What version?

If you profide a bit more info I might be able to help

regards

Allard

von Allard - am 01.08.2013 17:35
Hi Allard,

Sorry... WebDev, Version 17

Thanks again

von Randall - am 02.08.2013 17:31
Hi Randall,

Check if your array is already filled.
Remember the initialization order is:
1. Page global declarations
2. Control initialization
3. Page initialization

Also it would help if you posted the code to fille the list.

Regards,
Piet

von Piet van Zanten - am 02.08.2013 19:24
[attachment 594 ComboMissingInTable.png]

The screenshot shows there is no Combo in the Table, even though List of Values was selected as the Type. The Combo above the Table is one I put there for testing purposes because I haven't been able to get one to display in the Table. I haven't found much information about how to get a Combo into a Table, which leads me to believe there isn't much to it. Am I overlooking something obvious here?

von Randall - am 05.08.2013 18:21
Hmm webdev 17 ad a table control??

If I look at the table control I cannot seem to select list of values??

My options are:
-tekst
-numeric
-hig presision numeric
-currency
-date
-time
-duration
-checkbox ( if table is in ajax mode)
-image

To get what ( it I untherstand your question )you want I would use a looper control. In a looper you can punt anything you want and you can make it look like a table. It's easy to put a combo in. Just put a combo control in it. You can fill it in the control or you can fill it form a db table. Might come in handy if you want to be able to modify the items in the combo.


regards

Allard

von Allard - am 05.08.2013 23:01
Hi Randall,

If you don't give enough details we won't be able to help.
Code?
@Allard: perhaps php mode does not have combos in a tbale?

Regards,
Piet

von Piet van Zanten - am 06.08.2013 08:57
[attachment 597 TableDescriptionColumnType.png]

It's selectable as an option, so shouldn't it show up there?

Unfortunately, there's no code... the Combo element does not display in the Table Column, so there's no element displaying there to right click for a context menu to select code where I could populate the Combo with code in the element init.

Thanks again for any help on this...

von Randall - am 06.08.2013 12:55
[attachment 598 ComboMissingInTableColumn.png]

As shown in the post above, List of Values was selected as the Type... but there's no Combo in the Table Column as shown here. Is there another step to getting a Combo into a Table Column, or is the List of Values option for Table Column really not an option?

Thanks again for any help on this...

von Randall - am 07.08.2013 12:33
Hi Randall.

Normally I just leave a thread if someone fails to give relevant info.
However in this case I believe you don't have a clue what you are doing, so I give it a last try.

Of course you need to FILL the combo to get something to display in the column.
The way to fill it can be chosen in the content tab of the column properties.
You can choose filling it yourself by code using listadd (+glink) or link the combo to a file, query or array.
It's your choice.
And of course when displaying the table you need to set the column value to the stored value of the combo or its subscript.
About your last question:
Unlike in Windev where you can choose if the combo button is visible, in Webdev a "list of values" column only becomes a "real" combo when the table is in edit. When the table is in display, it appears a normal text column. (Which makes perfect sense for a webpage)

Regards,
Piet

von Piet van Zanten - am 07.08.2013 14:49
Hi Piet,

You are right. In php modus the list of values is not availeble.

allard

von Allard - am 07.08.2013 22:35
Hi Piet,

Thank you for your help. This is not as intuitive as it appears to be.
Here is some code I added in the Table init, trying to populate a Combo with an Array of values from a reference table.


i is int = 1
arrLocCode is array of strings
HReadSeekFirst(LOCFILE,AGENT,agyinfo.AGENT)
WHILE HFound(LOCFILE)
ArrayInsert(arrLocCode,i,LOCFILE.LOCCODE)
HReadNext(LOCFILE,AGENT)
i += 1
END
i = 1
FOR i = 1 _TO_ ArrayCount(arrLocCode)
ListAdd(TABLE_Agentemails.COL_Loccode, arrLocCode + gLink(arrLocCode))
END
gLinkActivate(TABLE_Agentemails.COL_Loccode)
ListDisplay(TABLE_Agentemails.COL_Loccode)
ListSelectPlus(TABLE_Agentemails.COL_Loccode,ListSeek(TABLE_Agentemails.COL_Loccode,agentemails.loccode))


I still don't see anything... it's like working in the dark.

von Randall - am 08.08.2013 12:57
Hi Randall,

Is your code is supposed to fill the combo with a list of codes that returns the same codes?
To me it would make more sense to use a list that shows some descriptions and returns the code.
Although it is possible to edit in a table if it is filled by a file, in Webdev I prefer a form to do the editing.

Basically your code should work, although you really don't need the array to fill the combo.

My approach would be to fill the combo in the PAGE global declarations like:
FOR ALL LOCFILE
ListAdd(TABLE_Agentemails.COL_Loccode,LOCFILE.LOCCODE+ gLink(LOCFILE.LOCCODE))
END
gLinkActivate(TABLE_Agentemails.COL_Loccode)

No need for ListDisplay and ListSelectPlus either.
Instead of ArrayInsert, ArrayAdd is much simpler. (although you don't need the array)

Now the key question is:
Does your COL_Loccode contain valid LOCCODES after the table is filled.
That depends on how you fill the table.

Regards,
Piet

von Piet van Zanten - am 08.08.2013 15:55
[attachment 602 ComboOk.png]

Hi Piet,

Thank you... as it turns out, the Combo was there when I had the code in the Table init but nothing was displaying because it apparently disregards the glink info and stores the index value of the combo. The value does not display in the table until it is replaced by the index value of the combo... and once it does that it displays the descriptive info as well, which is not wanted here. The field value in the the table is now simply a "1" instead of "N19001". N18001, B18001 and others will show up as "1" also... that's not good.


ListDeleteAll(COMBO_loctest)
HReadSeekFirst(LOCFILE,AGENT,agyinfo.AGENT)
ListAdd(COMBO_loctest," " + gLink(" "))
WHILE HFound(LOCFILE)
ListAdd(TABLE_Agentemails.COL_Loccode,LOCFILE.LOCCODE + " | " + LOCFILE.NAME + gLink(LOCFILE.LOCCODE))
HReadNext(LOCFILE,AGENT)
END
ListSelectPlus(TABLE_Agentemails.COL_Loccode,ListSeek(TABLE_Agentemails.COL_Loccode,agentemails.loccode))
gLinkActivate(TABLE_Agentemails.COL_Loccode)


The Combo itself looks good now, but storing the index value won't do me any good. Is there a way to make the Combo SelectedValue shown be the value that is stored, like in a regular Combo outside a Table? Also, I'm wondering... how come the ListAdd for a blank selection isn't showing up?

Thanks in advance for any help on this...

von Randall - am 08.08.2013 18:57
Hi Randall,

Anything added to the list will be displayed in the list, the glink part will be the stored value. Just like in Windev.
So you both the displayed and stored value can be the loccode.
The ListAdd with a blank is done on a different combo, so no wonder why it does not show up.
Also it's better to ad "" instead of a series of spaces, unless your databases stores trailing spaces. (by default Hyperfile SQL does not do this)
Again, the ListSelectPlus is useless, because the value of the columns in the table determine the corresponding row of the list.
Also I feel it's better to do the gLinkActivate right after you fill the list.

Regards,
Piet

von Piet van Zanten - am 09.08.2013 09:46
[attachment 603 DisplayedValuesStoredAsIndexValues.png]

Hi Piet,

Thank you again... good catch on the blank space.

For some reason the glink doesn't seem to be recognized because I have the glink set as the locfile.loccode, but the web page table value only displays when the data table value has been replaced by the index value of the combo. I can't use it this way because the index values are meaningless outside the context of the combo. It looks to me like the glink is being ignored... is this by design for combos in a table?

Thanks in advance for any help on this...

von Randall - am 09.08.2013 13:13
Hi Randall,

That's odd :confused: I have used the combo in a table using gLink.
I have 3 suggestions (if the first does not help try the next):
1. Did you try placing the code to fill the combo in the page global declarations?
2. Did you try a repair project?
3. Close the project and delete the following folders:
- language folder(s) (US, FR, NL etc.) from the root of your project
- .cpl folder from the root of you project
- the language folder(s) and the res folder from the _WEB folder.
Start Webdev again, all the deleted folders will be rebuilt again. The GUI errors will disappear after another recompile.
Just to be sure make a backup of these folders first (I never do that anymore because I know this method does no harm)

Hope this helps,
regards,
Piet

von Piet van Zanten - am 09.08.2013 17:11
Hi Piet,

Thank you for your reply...

I placed the code for the table combo in the page global declarations... no change.

I didn't find a menu item to repair the project.

I exited from WebDev... deleted the language folders, and .cpl folder from project root. I also deleted the language folders and the res folder from the _WEB folder. I went back in and recompiled... but, still no change. :(

Any other ideas?
Thanks in advance for any help on this...

von Randall - am 09.08.2013 18:30
Hi Randall,

I'm out of ideas, I suggest you create a sample project and submit the problem to Tech Support.

Regards,
Piet

von Piet van Zanten - am 11.08.2013 10:03
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.