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

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?

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.

Related

How to update tables in fields after amending existing information

I currently need to add to tables that update each time the user clicks the "Save" button on a program that updates any of their information.
When any of the fields are amended, in order that we have a log of the changes, I need to create a record on a "slinfo" table including things like:
Customer name (slinfo.name)
Customer account (slinfo.acode)
The date (slinfo.date)
And slinfo.seq, which is the sequence number for each change.
How would I go about doing something like this?
you can handle this with Database Triggers
https://documentation.progress.com/output/ua/OpenEdge_latest/pdsoe/PLUGINS_ROOT/com.openedge.pdt.langref.help/rfi1424920170039.html
you have also access to the old field value and the new field value in the trigger statement
simple write procedure:
TRIGGER PROCEDURE FOR WRITE OF Customer
CREATE slinfo.
ASSIGN
slinfo.name = Customer.NAME
slinfo.acode = Customer.account
slinfo.date = TODAY
slinfo.seq = NEXT-VALUE(seqSlinfo)
.
/* presumably you already have a save trigger to save the amended values
* this code should go in that trigger, probably at the end
*/
/* I, obviously, have no way to know where the actual values for
* these variables are supposed to come from. if the logic for
* that is simple enough you might even be able to eliminate the variables
*/
define variable nameVariable as character no-undo.
define variable acodeVariable as character no-undo. /* I'm guessing that this is a character field */
define variable seqVariable as integer no-undo.
/* do something to populate the variables...
*/
/* since you are apparently already saving changes to slinfo
* you just need to add a few fields
*/
assign
slinfo.name = nameVariable
slinfo.acode = acodeVariable
slinfo.date = today
slinfo.seq = seqVariable
.

How to hide form fields data? - PROGRESS 4GL?

Below query is giving results as expected but it fails to hide form field value when the variable lvl_select is set to Yes or No after updating the form fields.
Expected Results:
When lvl_select = Yes then update only form field lvc_part
When lvl_select = no then hide update the value of the form field lvc_part and update lvc_part1 whereas lvc_part1 then hide the value of the form field lvc_part and update lvc_part1
DEFINE VARIABLE lvl_select AS LOGICAL NO-UNDO.
DEFINE VARIABLE lvc_part AS CHARACTER NO-UNDO.
DEFINE VARIABLE lvc_part1 AS CHARACTER NO-UNDO.
DEFINE VARIABLE path AS CHARACTER NO-UNDO.
FORM
lvl_select COLON 20
lvc_part COLON 20
lvc_part1 COLON 20
path
WITH FRAME a no-labels width 80 ATTR-SPACE.
mainloop:
REPEAT:
DISPLAY
lvl_select
lvc_part
lvc_part1
path
WITH FRAME a.
UPDATE
lvl_select
WITH FRAME a.
IF lvl_select = YES THEN
DO :
UPDATE
lvc_part
WITH FRAME a.
END.
ELSE
DO:
UPDATE
lvc_part1
WITH FRAME a.
END.
END.
DISPLAY and UPDATE work with the whole frame. UPDATE doesn't hide part of a frame just because you didn't update anything.
One way to get the result that you seem to want would be to HIDE the fields you don't want to see in your logic branch. Another would be to use two different frames.
Also - ATTR-SPACE was used to reserve space on screen for certain very old terminals from the 80s that had so little memory that they needed to spaces on the screen to store the start of attributes like REVERSE and UNDERLINE. These terminals were fondly referred to as "space wasters". Nobody actually makes such a thing anymore and I very seriously doubt that you are using an emulator that needs that attribute.
To hide lvc_part in the ELSE block, write
HIDE lvc_part IN FRAME a.

Laravel Form input type="text" select data from another table on type type suggest existing data from the table and select

How can i create a form like the one on linkedin. On form input type when i type is going to fect data from a database if not existis is going to create it and fetch d and store to another table
on form input type, immediately get result: This can be done by AJAX. Laravel support Vue which can do this easily:
1a. call a function in the mounted() part.
1b. the function call itself by putting setTimeout(this.functionName,1000) at the end.
1c. in the function, check if the text in the text box is changed. if yes, make a request by axios.get('blablabla').then(response=>{//put the response into vue dataArrayName in data part});
1d. the html template is auto-updated by v-for="dataArrayName"
looks like the search is done by comparing char by char from the beginning of the string to the data.
if you press enter, pass the search string to the controller, use some logic to determine whether it is needed to create row in database

Custom field data input wenzhixin/bootstrap-table

Hi! I want custom field data, because I have many arrays in one array.
I try using field: 'LeftNavigation.Title' but it didn't work.
You can't using multi Array data in field
Maybe you should choose another solution for this
Suggest : Create Leftnavigation Field , when click on this field it's show a second table show data from Leftnavigation array

Lookup field appears as numerical values instead of text on Access report

I am trying to create a report putting a field called contact which has the name of a person. This name is linked directly to another table where I keep all the contacts.
For some strange reason, when I include this name (which in query view displays as the name of the contact), instead of the name appearing, the unique ID number is shown on my report.
As mentioned in the article cited in the above comment, you can use a Combo Box control on your report to do the lookup for you. To see how this can be done, create a new report based on the table containing the lookup field, then drag and drop that field onto the report. That will create a Combo Box control with properties that look something like this:
Row Source: SELECT [Clients].[ID], [Clients].[LastName] FROM Clients;
Bound Column: 1
Column Count: 2
Column Widths: 0";1"
You could use a similar Combo Box control on your actual report to display the client's name rather than their numeric ID value.
Another alternative would be to change the Control Source of the report's Text Box control to have it do a DLookUp() on the table. If the lookup field is named [client] then changing the Control Source of the Text Box to something like
=DLookUp("LastName","Clients","ID=" & [client])
would also work.
I wanted to add to the great answer by Gord:
When using a "web" database (started in Access 2007 I think), you cannot change a report's fields to ComboBox style, nor can you use DLookUp(). (web databases lack a ton of features)
The workaround for this, if you want to create a Web-Report that uses lookup fields, is to create a Web-Query first based on your Web-Table (all the Web-* stuff has a www planet icon over the logo, if you create a new Web-DB in Access 2007+ you'll see what I mean)
So, instead of Table -> Report, you'll have to do W-Table -> W-Query -> W-Report.
Then, the only thing you need to customize to get the data right is the W-Query. Start by trying to reproduce the look in the query to match what you want users to see in the report. Note that here in the query, lookups will work fine (instead of the unique ID's, you get field names like you want). However, this will not carry over to the report. To do that, you gotta get the actual text field name you want into the query:
You should already have one table in your query; start by adding the table that your first lookup field points to. For example, the table I want to print is called Stock_Boards, and it has a lookup field called PCBID_lookup that points to the table Stock_PCBs.
Since you're using lookup fields, there should already be a relationship line between the two tables when you add the second one. If there isn't, something has gone horribly wrong.
Now, see how that line connects two fields on the two different tables? For example, I've got my PCBID_lookup field on my Stock_Boards table, which connects to the ID field on my Stock_PCBs table. If I created a report from this now, PCBID_lookup would be a number, a number that correlates to the ID of a record on Stock_PCBs.
To fix it, I will add the name field I want to show up on the report. In my example, that happens to be a Part Number, rather than the ID. I add the PartNumber field from my Stock_PCBs table to the query, and remove the PCBID_lookup field of the Stock_Boards table from my query.
Since PartNumber is what I want to show up on my report, it effectively replaces the original field (PCBID_lookup)
Repeat for all lookup fields you want in your report.
I had 1 more: I removed the Status field of the Stock_Boards table (which was an ID/Lookup) and added the 'Status' field from the Status table (which was the actual text name)
When finished, your query should look exactly how you want the data to appear, without any special tricks or asking Access to do something unnatural. Save your query, and create a web-report from it. Done!

Resources