I have a table in my html page having name, value1 and value2 in one sql table and value3 and value4 in another sql table. Now I want to find the minimum of (value3-value2) and display it in another small html table and in the same table I want to display the corresponding name whose value is minimum(value3-value2) using codeigniter. Plz help me for this how i can write Model, Controller and view.
I'm assuming you already have the methods for fetching the values1-4. Now you just have to pass that data trough you view from the table3 method and there you just use the build in php function min($array). Refference: http://php.net/manual/ro/function.min.php
Related
Hi any one can help me on this issue which i have problem insert a dynamic value which is from previous database table value to pass to another table in Katalon.
Please find my information below:-
This screenshot is ab.dbo.DOCUMENT table which DOCUMENT_ID is auto populate with value
which mean it will appear random number by itself.
Another screenshot is bc.dbo.DOCUMENT_IC table which i need to manually key in DOCUMENT_ID in
the value base on on what it is given from ab.dbo.DOCUMENT table DOCUMENT_ID.
Attached of a screenshot for bc.dbo.DOCUMENT_IC
In Katalon i am using a keyword to connect my database, insert query and close
connection. I am aware of this step and able to connect to database with katalon. But i
am not very sure how to pass a dynamic value from ab.dbo.DOCUMENT table DOCUMENT_ID which
it can randomly appear a number value to bc.dbo.DOCUMENT_IC table DOCUMENT_ID which i need to
manually key in a value base on the value given.
Below is my Katalon script:-
Hopefully someone can help me on this
Thank you.
If I have a table with an auto incrementing ID in one table and I need that value elsewhere I would typically write sql like this :
insert into firsttable (Document_Type) values ('PDF');
insert into secondtable (Document_ID, App_ref_Num) values (##Identity, 'somenumber')
In the databases I have worked with ##Identity will give you the integer or id of the last inserted row. If you can't run multiple statements most connection libraries will have something like a $conn->insert_id that will do the same thing as running select ##identity.
I have one field on my form (field example name "completion_date"). This data is stored to table column "completion_date". When users edits the detail, data is overwritten in the backend table field as a default way of storing the data. How can I pass on the existing data in this column to a new column (completion_date_a) when the user saves a new date in the field.
One option is to create a database trigger, e.g.
create or replace trigger trg_bu_date
before update on your_table
for each row
begin
:new.completion_date_a := :old.completion_date;
end;
/
Littlefoots' answer is correct, but you could also do this in apex with very little work. Suppose your form items are P1_COMPLETION_DATE and P1_COMPLETION_DATE_A, both mapped to their respective database column. P1_COMPLETION_DATE_A is hidden. Add a computation to P1_COMPLETION_DATE_A with point "After Header" and type "Item". Pick P1_COMPLETION_DATE as item.
Now when you save the form, the value of P1_COMPLETION_DATE_A will be set to the value of P1_COMPLETION_DATE when it was selected.
I have the input form as shown below
data on health facilities(fasilitas keselamatan), safety facilities(fasilitas kesejahteraan) taken from a different table. And then the contents of the form
in store in another table inside there is id corporation and id safeties, this is pivot table
how to function store on its controller?
I am not able to trim the string which is fetched from mysql db and insert into another table using jmeter
In Jmeter, using JDBC request I am able to fetch data from database. In my table there are 2 coloumns. One is a data coloumn and other is ID. My requirement is I want to retreive all data(which is a string with comma seperated) and need to trim the data based on comma seperation.
For eg: "=XXXXIoT2?data=$XXXX,P10,999194446131444,20170308170009,14,1"
Then these trimmed strings need to be inserted into seperate coloumns of a table. How can i acheive this? Kindly help me
If the ID is 1, you can use below snippet to retrieve the ID.
String mystring = "=XXXXIoT2?data=$XXXX,P10,999194446131444,20170308170009,14,1";
String[] aftersplit = mystring.split(",");
System.out.println(aftersplit[aftersplit.length-1]);
Is there a way to obtain the value of the primary key in a materialized view that after I update it? I'm using VB to update a table and I'd like to return the key of the row I updated so I can use it in subsequent operations. The view will always contain a single record.
I found the answer. It looks like I just need to execute the "Output Inserted.ID" after my update statement.
For example:
UPDATE MyDB..MyView Set record_locked=1 OUTPUT INSERTED.Id