| |
| Publicado el 28,junio 2016 - 00:06 |
Hi Everyone.
I'm looking for the best practice to resolve the following. I may be missing the obvious….
Data file has 1000+ products of which only +-20 are active at any one time.
In a table of e.g.: product records there is a productid linked to a combo control that returns the product name. All possible products must be in the content query to display all possible ids.
However. If the user is to select a product for a new record, they must only be able to choose a product that is currently "Active". Ie: select from a shorter list of options.
Currently I use two columns, one to display and another as the chooser. The chooser is only made visible in edit mode. I would ideally like the on column to handle the complete scenario. Ie: the dropdown has a different list to whats viewed.
thanks Mark |
| |
| |
| | | |
|
| | |
| |
| Publicado el 28,junio 2016 - 01:33 |
Hello Mark
Do you fill the combo before the table loads ? If so just restrict the data before you load the combo with either a file filter or a query as the source.
Regards Al |
| |
| |
| | | |
|
| | |
| |
| Publicado el 28,junio 2016 - 02:01 |
Hi Al
Thanks for response. Not sure I understand you. Combo has Qry_AllProducts set up in the column description.content. I need qry_ActiveProducts when selecting the product. If I use a filter on the qry_Allproducts then inActive product descriptions will be blank.
Regards Mark |
| |
| |
| | | |
|
| | |
| |
| Publicado el 28,junio 2016 - 02:41 |
Hello Mark
Maybe it only works for memory tables but you can prefill the combobox before you load the table "ExpenseType" is a combobox in the memory table calle "TABLE" This code fills it before I load the records into the table. The combobox in the table is set as "Return the Value specified by Glink"
//Setup the expense types gLinkActivate(TABLE.ExpenseType) ListDeleteAll(TABLE.ExpenseType) HReadFirst(ExpType,EXCLEUNIK) WHILE NOT HOut(ExpType) ListAdd(TABLE.ExpenseType,EX.Description+gLink(EX.EXCLEUNIK)) HReadNext(ExpType,EXCLEUNIK) END
//Fill the memory table
As you can see, I can put whatever I like into the combobox and it displays the items that matches the underlying data from the table.
Regards Al |
| |
| |
| | | |
|
| | |
| |
| Publicado el 28,junio 2016 - 04:46 |
Hi Al
I've had a play with gLink ( last week and again now) and looked at all the documentation I can find. It makes no sense to me, so struggling. Wish I could find a good explanation of how link works.
Can you help me a bit more, as to how I code this. Steps I think I need to do
1. Make table a memory table. - done that 2. Check the "Return Value by gLink" in Details tab - done that 3. Have the content of the col_prdname in the table description = try_allproducts to get the rows of the table to lookup product name correctly 4. Col_prdname is linked to stock.prdid 3. Load data from qry_ActiveProduct into Table_StockReceipt.col_prdname which is the combo box control when I init the table HExecuteQuery(QRY_ActiveProducts,hQueryDefault) gLinkActivate(COL_PrdName) ListDeleteAll(COL_PrdName) HReadFirst(QRY_ActiveProducts) WHILE NOT HOut(QRY_ActiveProducts) ListAdd(COL_PrdName,QRY_ActiveProducts.prdname+gLink(QRY_ActiveProducts.prdid)) HReadNext(QRY_ActiveProducts) END
4. Execute my qry_AllSales and TableDisplay from Filter button
Results of this.
test 1 - table shows blank instead of product name and combo box has all lines test 2 - set glink code to run after setting filter, the combo box shows only active products, but retuns wrong name, and the column still returns a blank
regards Mark |
| |
| |
| | | |
|
| | |
| |
| Publicado el 28,junio 2016 - 05:34 |
HI Al
Solved the blanks problem. ...wrong link field Not getting the active only list when I load the form. Can load it if I run the above code after my filter, but get no link value returned. col_prdname returns 0 after selecting the rename from the combo box
Thanks Mark |
| |
| |
| | | |
|
| | |
| |
| Publicado el 28,junio 2016 - 14:04 |
Hello Mark
The combobox can return the actual string displayed in the box, its numeric row count or the invisible glink() value attached to the current row. The value your query puts into the col_prdname column should find a match in the glink value of QRY_ActiveProducts.prdid in the combo box. The glink value from the combo box would be val(col_prdname)..storedvalue
Regards Al |
| |
| |
| | | |
|
| | |
| |
| Publicado el 28,junio 2016 - 14:44 |
Hi Mark,
just in case you didn't think of that solution already... It should be possible to set the height of each non active line in the combo to ZERO when in edit mode with a loop.
It should also be possible to : - load the whole file in a query and keep it there during the life span of your table - Load the combo content by code, either with ALL lines or only ACTIVE lines when needed As all would be done in memory, it should be very fast...
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,junio 2016 - 02:41 |
Thanks AL and Fabrice.
Lots to try out. I'll get back soon. |
| |
| |
| | | |
|
| | |