|
Started by Antonio Díaz, Feb., 24 2021 10:29 PM - 6 replies |
| |
| | | |
|
| |
Registered member 71 messages Popularité : +2 (2 votes) |
|
Posted on February, 24 2021 - 10:29 PM |
Hi, I come from Clarion and just started playing with WINDEV. One of the things I am trying to do is a lookup. I want to be able to assign a selected value from a list and to some edit control. If the value typed doesn't exist I want to create it in the lookup table.
May be I am just to attached to Clarion, how is this done in Windev? What are the options? I would appreciate any help.
--
Antonio Diaz Emphasys Software, S.C. |
| |
| |
| | | |
|
| | |
| |
Posted on February, 25 2021 - 12:38 PM |
There is no ready made tool for that, but there are many ways to do it...
You can use a combo with input, if your value is a simple one. When something is entered, you check if it exists and do a hadd if not.
If the value is more 'complex' (ie you will have to enter several fields values to create a new record), you should use a separate window with a table or looper to select, and a new button to create the missing record. Personnaly, I learned to create one basic file management window for each file, with plane for the different functions: - plane 1 is list/select and action buttons (new/edit, select, save, cancel) - plane 2 is the form
Parameters in entry let me know what the window is called for, either a regular management (plane 1 without the select button visible), direct creation or edit (plane 2), selection (plane 1, WITH or WITHOUT the new/edit buttons visible)...etc |
| |
| |
| | | |
|
| | |
| |
Registered member 71 messages Popularité : +2 (2 votes) |
|
Posted on February, 25 2021 - 10:03 PM |
Thanks Argus, I will try to do that, it sounds like a good idea. I will struggle, but I will learn...
--
Antonio Diaz Emphasys Software, S.C. |
| |
| |
| | | |
|
| | |
| |
Registered member 795 messages Popularité : +40 (42 votes) |
|
Posted on February, 26 2021 - 4:59 PM |
Hi. To see correct Windev code examples you can generate the RAD of the database to see how it could be done. It is easy to learn this way.
Rubén |
| |
| |
| | | |
|
| | |
| |
Registered member 71 messages Popularité : +2 (2 votes) |
|
Posted on February, 26 2021 - 7:56 PM |
Hi Rubén, I followed your advice but still don't get what I want. I created an analysis with the links but the app that gets created has no lookups, it just validates that whatever I type in the form has to be in the lookup table.... am I missing something?... Thanks for your help..
--
Antonio Diaz Emphasys Software, S.C. |
| |
| |
| | | |
|
| | |
| |
Registered member 795 messages Popularité : +40 (42 votes) |
|
Posted on February, 27 2021 - 5:58 PM |
Hi. To search for records that meet one or more conditions you really have several options depending on the tables that are included.
1 single table: use filters (hFilter) you define the filter and refresh the Table of records. It shows you only the records that match. When you finish filtering you use hDeactivateFilter.
2 or more tables: you can create a Query in the editor and assign it as data source in the Table or in the result path. In the table initialization you assign the values to the query fields and refresh the table. It shows you only the records that comply.
Rubén |
| |
| |
| | | |
|
| | |
| |
Registered member 3 messages |
|
Posted on February, 28 2021 - 7:54 AM |
Hi Antonio.
It's not clear what exactly you want to do.
option 1 - add a combobox to the column of the table ( using the wizard to help populate it.)
option 2 - code the column of the table . If you have a table and want to enter for example a sales invoice. The product code field when item code entered will need to do a lookup and return a valid product. Below is code put in the column's "Exit from col_prdcode" code section. It looks up the item and if not found opens a popup window where user can select available options from a list. The popup window can contain any controls and a table with multiple columns of info. You could also just do a yesno() and add the new record to the appropriate database. use HAdd(0 command.
// Set 1 - Set environ
// check if valid product code and loop if 0 IF MySelf < 1 THEN // no product RETURN END
// Only process if modified the code IF MySelf..Modified THEN MySelf..Modified = False // continue processing ELSE // nothing to do RETURN END
nNewPrdid is int = 0
// Step 2 - Lookup Product code and confirm valid code selected HExecuteQuery(QRY_PrdCodeSearch,hQueryDefault,MySelf..DisplayedValue,Null) nRec is int = HNbRec(QRY_PrdCodeSearch)
IF nRec = 1 // Found one record so ok to accept HReadFirst(QRY_PrdCodeSearch) MySelf..Value = QRY_PrdCodeSearch.prdcode nNewPrdid = QRY_PrdCodeSearch.prdid ELSE // run pop to find product nNewPrd = Open(WIN_prdLookup2,MySelf,TABLE_NZDlines.COL_lininvqty) IF nNewPrd > 0 THEN gnHedID = fixheader.hedid // Adds an order line lp_NewFixLines(EDT_NewQty,nNewPrd,"Enter Details here...", False) // Resets the addition quantity to 0 EDT_NewQty = 0 // Recalculate the totals lp_InvRecalc() // Resumes the input from the quantity (to perform several successive inputs) EDT_NewQty = 1 ReturnToCapture(COL_lininvqty) ELSE RETURN END END
hope that helps.
-- Mark Crichton DataWise Ltd New Zealand |
| |
| |
| | | |
|
| | | | |
| | |
|