openedgeprogress-4glprogress-db

how to add and display specific records from code_mstr to temp-table in progress 4gl?


I want to create a temp-table for generalized code maintenance(code_mstr) this is what I have written for the temp-table creation

define temp-table tt_gcm no-undo
field tt_fldname like code_fldname
field tt_value like code_value
field tt_cmmt like code_cmmt
field tt_group like code_group   
field tt_domain like global_domain
index tt_idx
      tt_domain
      tt_fldname
      tt_value.

and after this I defined a form for the same

form
code_fldname
code_value
code_cmmt
code_group
with frame a side-labels

I also gave prompt-for for code_fldname and code_value because I want it to have user input

prompt-for code_fldname
editing:
/*wrote the mnfnp05.i logic here that enabled the input */
/*similarly for code_value as well */

now I only want to display the records that I enter via the input field, I don't want to display all the records that are present in the code_mstr, is there a way to display those specific recprds?


Solution

  • You really shouldn't use a db field for the prompt-for. In the long term that is going to lead to you having record locking and transaction scoping issues. It is much better to use a variable instead. Something like this:

    define variable codeName as character no-undo.
    
    update codeName.
    
    find tt_gcm where tt_gcm.fldName = codeName no-error.
    
    if available tt_gcm then
      display tt_gcm with frame a.