Substraction of two database-fields
Hello everybody,
I'm busy with a java-assignment for school. We have to build an application that functions like a ATM. We have to get and save information in a database.
We're working with several files, and the following is one of them.
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
public class UpdateRecord implements ActionListener {
private ScrollingPanel fields;
private JTextArea output;
private Connection connection;
public UpdateRecord( Connection c, ScrollingPanel f,
JTextArea o )
connection = c;
fields = f;
output = o;
public void actionPerformed( ActionEvent e )
try {
Statement statement = connection.createStatement();
if ( ! fields.id.getText().equals( "" ) ) {
String query = "UPDATE pintabel SET " +
"saldo='" + fields.saldo.getText() + "', pin='" + fields.pin.getText() +
"' WHERE id=" + fields.id.getText();
output.append( "\nAktie verzonden: " +
connection.nativeSQL( query ) + "\n" );
int result = statement.executeUpdate( query );
if ( result == 1 )
output.append( "\nGeld is opgenomen\n" );
else {
output.append( "\nGeld opnemen mislukt\n" );
fields.saldo.setText( "" );
fields.pin.setText( "" );
statement.close();
else
output.append( "\nYou may only update an " +
"existing record. Use Find to " +
"locate the record, then " +
"modify the information and " +
"press Update.\n" );
catch ( SQLException sqlex ) {
sqlex.printStackTrace();
output.append( sqlex.toString() );
The bold line is the problem ("saldo='" + fields.saldo.getText() +).
There's a value in the field saldo, but we also have a certain value in a field called opnemen. What we want to do is substract the value in the opnemen-field from the value in the saldo-field. We've tried several things, but we can't work it out. Can anybody help me?
Many thanks,
Michael Roos
First, you should know that there is a set of updateXXX() methods in Java 2.0. So, when you have the correct row of the resultSet in hand you can use:
updateString(3,"Hello world!")method to update the field in the column 3 to a String with value "Hello world!". This is just an example of course.
To make this example complete see this:
// assume you have the right row from the resultSet in hand.
// assume rs is your resultSet
int foo = rs.getInt(1);
foo += foo*0.05;
// and other calculations here
rs.updateInt(1,foo);
rs.updateRow(); // This line is here so as to make the changes
// permanent.
// No need to mention that you cannot change primary
// keys...Second, I think I've given you a very clear example of what you can do. And since this is a Java assignment you don't want to be spoon-feeded, do you? :)
Hope this helped.
afotoglidis
Similar Messages
-
How to display two database field in report
hi,
i have made a report and in that report i am displaying two fields with same data and these fields are database.In the FORM f_display_report i have given the same name in both fields.But when i going to SUM it gave me only one field SUM and other fields gives null.
give me some guidance as i have to display both fields with same data and same amount of SUM.
Thanksif i am using the database field i-e wt_qbshb then it gave me the data but when im going to sum both field it gave me sum of only one field.This the code:
ITAB:
BEGIN OF gi_main OCCURS 1,
belnr LIKE bseg-belnr, " Document No.
buzei LIKE bseg-buzei, " Item
blart LIKE bkpf-blart, " Document Type
lifnr LIKE bseg-lifnr, " Vendor No.
lifntn LIKE lfa1-stcd2, " NTN
lifnic LIKE lfa1-stcd1, " CNIC
name1 LIKE lfa1-name1, " Vendor Name
stras LIKE lfa1-stras, " Address
ort01 LIKE lfa1-ort01, " City
qekar LIKE v_t059e-qekar, " Source of income Description
qscod LIKE v_t059z-qscod, " Section Code
budat LIKE bkpf-budat, " Date of Payment(DD/MM/YYYY).
dmbtr LIKE bseg-dmbtr, " WHT Base Amount
qsatz LIKE v_t059z-qsatz, " Rate of WHT
dmbtr LIKE bseg-dmbtr, " WHT Base Amount
wt_qbshb LIKE with_item-wt_qbshb, " Amt of tax collected & deducted
AMT_TAX TYPE with_item-wt_qbshb, "Amt tax Deposited.
p_tax type sy-datum, " Date of Tax Deposited
witht LIKE t059z-witht, " WHT Type
wt_withcd LIKE t059z-wt_withcd, " WHT Code
hkont LIKE with_item-hkont, " Gl Code
text40 LIKE t059ot-text40, " Section Description
eatxt LIKE v_t059e-eatxt, " Source of Income Code
END OF gi_main,
and this is the BEGIN OF gi_main OCCURS 1,
belnr LIKE bseg-belnr, " Document No.
buzei LIKE bseg-buzei, " Item
blart LIKE bkpf-blart, " Document Type
lifnr LIKE bseg-lifnr, " Vendor No.
lifntn LIKE lfa1-stcd2, " NTN
lifnic LIKE lfa1-stcd1, " CNIC
name1 LIKE lfa1-name1, " Vendor Name
stras LIKE lfa1-stras, " Address
ort01 LIKE lfa1-ort01, " City
qekar LIKE v_t059e-qekar, " Source of income Description
qscod LIKE v_t059z-qscod, " Section Code
budat LIKE bkpf-budat, " Date of Payment(DD/MM/YYYY).
dmbtr LIKE bseg-dmbtr, " WHT Base Amount
qsatz LIKE v_t059z-qsatz, " Rate of WHT
dmbtr LIKE bseg-dmbtr, " WHT Base Amount
wt_qbshb LIKE with_item-wt_qbshb, " Amt of tax collected & deducted
AMT_TAX TYPE with_item-wt_qbshb, "Amt tax Deposited.
p_tax type sy-datum, " Date of Tax Deposited
witht LIKE t059z-witht, " WHT Type
wt_withcd LIKE t059z-wt_withcd, " WHT Code
hkont LIKE with_item-hkont, " Gl Code
text40 LIKE t059ot-text40, " Section Description
eatxt LIKE v_t059e-eatxt, " Source of Income Code
END OF gi_main,
and this is the BEGIN OF gi_main OCCURS 1,
belnr LIKE bseg-belnr, " Document No.
buzei LIKE bseg-buzei, " Item
blart LIKE bkpf-blart, " Document Type
lifnr LIKE bseg-lifnr, " Vendor No.
lifntn LIKE lfa1-stcd2, " NTN
lifnic LIKE lfa1-stcd1, " CNIC
name1 LIKE lfa1-name1, " Vendor Name
stras LIKE lfa1-stras, " Address
ort01 LIKE lfa1-ort01, " City
qekar LIKE v_t059e-qekar, " Source of income Description
qscod LIKE v_t059z-qscod, " Section Code
budat LIKE bkpf-budat, " Date of Payment(DD/MM/YYYY).
dmbtr LIKE bseg-dmbtr, " WHT Base Amount
qsatz LIKE v_t059z-qsatz, " Rate of WHT
dmbtr LIKE bseg-dmbtr, " WHT Base Amount
wt_qbshb LIKE with_item-wt_qbshb, " Amt of tax collected & deducted
AMT_TAX TYPE with_item-wt_qbshb, "Amt tax Deposited.
p_tax type sy-datum, " Date of Tax Deposited
witht LIKE t059z-witht, " WHT Type
wt_withcd LIKE t059z-wt_withcd, " WHT Code
hkont LIKE with_item-hkont, " Gl Code
text40 LIKE t059ot-text40, " Section Description
eatxt LIKE v_t059e-eatxt, " Source of Income Code
END OF gi_main,
and this is the PERFROM DISPLAY REPORT:
PERFORM fill_fieldcat USING 'LIFNTN' 11 'NTN' 'GI_MAIN'.
PERFORM fill_fieldcat USING 'LIFNIC' 16 'NIC' 'GI_MAIN'.
PERFORM fill_fieldcat USING 'LIFNR' 10 'Vendor' 'GI_MAIN'.
PERFORM fill_fieldcat USING 'NAME1' 35 'Name' 'GI_MAIN'.
PERFORM fill_fieldcat USING 'STRAS' 35 'Address' 'GI_MAIN'.
PERFORM fill_fieldcat USING 'ORT01' 35 'City' 'GI_MAIN'.
PERFORM fill_fieldcat USING 'QEKAR' 40 'Nature of Payment etc' 'GI_MAIN'.
PERFORM fill_fieldcat USING 'QSCOD' 10 'Payment Section Code' 'GI_MAIN'.
PERFORM fill_fieldcat USING 'BUDAT' 10 'Date of Payment(dd/mm/yyyy)' 'GI_MAIN'.
PERFORM fill_fieldcat USING 'DMBTR' 20 'Value/Amount on which Tax Collected or Deducted' 'GI_MAIN'.
PERFORM fill_fieldcat USING 'QSATZ' 10 'Rate of tax (%)' 'GI_MAIN'.
PERFORM fill_fieldcat USING 'WT_QBSHB' 16 'Tax Amount Collected/Deducted' 'GI_MAIN'.
PERFORM fill_fieldcat USING 'WT_QBSHB' 16 'Amount of Deposited' 'GI_MAIN'.
PERFORM fill_fieldcat USING 'P_TAX'(001) 15 'Date of Tax Deposited(DD/MM/YYYY)' 'GI_MAIN'.
Thanks. -
Pupulating two database fields from one form field
Hopefully an easy query for someone with more experience than
me!!!
I have set up a form (PHP page) to add new users to a table
in a MySQL database. So far, so good.
The problem is that I want to use the value entered in one of
the form fields (Email) to populate two different fields in the
table (username and email). I realise that this is redundant, but
it is necessary for other reasons that I won't go into here...
I've tried using a hidden input field for username, but I'm
just not sure what I need to specify for 'value'...
The code for the input field is:
<input name="Email" type="text" class="RequiredInput"
value="" size="32">
and the code for the hidden input is:
<input type="hidden" name="username" value=Email>
As you can see, this puts the text 'Email' in the field,
rather than the value of the Email input...When I try an post a reply with the code attached I get this
screen:
The page you requested could not be found on our web site.
You may wish to try one of the following links:
Search
Search the Adobe web site.
Adobe Homepage
Go to the Adobe homepage.
Macromedia Flash Player
Download the Macromedia Flash Player.
Broken Link?
Send us an e-mail.
When the forum's working again I'll have another go at
posting the code... -
Can't add database field or text object to a report (new and existing)
We have Crystal Report 8.5 and when trying to modify an existing report or create a new report, I can't seem to add any database fields or text objects in my report. I get a prohibition symbol (circle with a backslash inside it) when I hover over the report. Has anyone encoutered something like this? Any suggestions? Thank you.
Do you have two monitors?
I had this problem if I tried to open crystal in the second monitor, move it back to primary monitor and it should be OK.
Ian -
Add two new field in s_alr_87012936?
Hi Experts,
I want to add two new field in the report of T-code S_alr_87012936. I have copied that report into a Zreport.
Can anyone reply how to add two new field in the selection screen. As the program uses logical database ADA.
Have I to create a z logical database or simply add selection-screen and fetch data? Which option is better?Hi,
You can create the report category and add those fields, if that fields are available in LDB. Or you can create your own selection screen with those fields and used in the report iin report selection screen you will get LDB selection screen as well your selection screen. -
How to compare a database field and form field and highlight differences
Hi there,
I have been trying to find a coldfusion function that will help, I have tried comparing two strings but the results of -1 1 or 0 aren't very useful.
I need to compare a database field with a form field and highlight all the differences in the form field in red.
Thanks
KatieThis is a non-trivial process. Rather than doing a compare, you really are wanting to do a diff. CF doesn't do this out of the box, but you might want to have a sniff around on Google to see if anyone has implemented anything for CF.
Some reading:
http://en.wikipedia.org/wiki/Diff#Algorithm
Adam -
Generate query at a time & connect two database ?
Hi
Could u help me? it is necessary that
I have two database ( RSHPL,RSPL) and both data base have same table name and same fieldname (Table Name :-OITM, Fieldname :ONHAND ,pk- ITEMcode,)
At first I tell u what I want?
I want to generate query at a time & connect two database and same table name(OITM) to select the TOTAL VALUE of this field(ONHAND) and pk-key is Itemcode.
Is it Possible? If Possible plz write this query and send me.Hi,
I don't think its possible to write a query from within SAP that allows you to get data from another SAP database.
I have used SQL Reporting Services to report on data from multiple databases, and this works very well for many of my clients. It depends on what you want to do with the data, do you need to display it on the screen in SAP and it to a field or will a report suffice?
Regards,
Adrian -
Trigger in a join table between two database
Hi an Happy new year
I have two database, one is dedicated to security and the second for my multitenancy application
In this two databases one have tables USER, USER_JOIN_USER_ROLE and USER_ROLE
the second, USER (where fields are differents), USER_JOIN_USER_ROLE and USER_ROLE
the two join table must be the same and USER_ROLE are the same in the two databases.
I plan to use a trigger to replicate from the application database to the security one, I already use triggers to Replicate USER and set the differents fields.
I'm new in triggers using.
My user replication trigger seems like that
CREATE TRIGGER [dbo].[USER_REPLICATION]
ON [dbo].[DM_USER]
AFTER INSERT
AS
BEGIN
DECLARE @EmployeeId int = (SELECT FKEmployee FROM inserted)
DECLARE @Login nvarchar(50) = (SELECT LoginUser FROM Inserted)
DECLARE @Password nvarchar(50) = (SELECT PasswordUser FROM Inserted)
DECLARE @Tenant int = (SELECT IdCompany FROM TEST_MULTI.dbo.DM_COMPANY WHERE IsTenant = ''Y'')
DECLARE @CompanyId int = (SELECT ExtIdCompany FROM TEST_MULTI.dbo.DM_COMPANY WHERE IsTenant = ''Y'')
DECLARE @LegalEntityId int = (SELECT FKLegalEntity FROM TEST_MULTI.dbo.DM_EMPLOYEE WHERE IdEmployee = @EmployeeId)
DECLARE @LastName nvarchar(255) = (SELECT LastNameEmployee FROM TEST_MULTI.dbo.DM_EMPLOYEE WHERE IdEmployee = @EmployeeId)
DECLARE @FirstName nvarchar(255) = (SELECT FirstNameEmployee FROM TEST_MULTI.dbo.DM_EMPLOYEE WHERE IdEmployee = @EmployeeId)
DECLARE @EMail nvarchar(255) = (SELECT EMail FROM inserted)
SET NOCOUNT ON;
INSERT INTO DM_SECURITY_MASTER.dbo.DM_USER(LoginUser, PasswordUser, FKCompany, TenantId, LegalEntityId, LastName, FirstName, Email)
VALUES (@Login, @Password, @CompanyId, @Tenant, @LegalEntityId, @LastName, @FirstName, @EMail)
UPDATE [TEST_MULTI].[dbo].[DM_USER] SET ExtIdUser = (SELECT IdUser FROM [DM_SECURITY_MASTER].[dbo].[DM_USER]
WHERE LoginUser = @Login
AND PasswordUser = @Password
AND FKCompany = @CompanyId
AND TenantId = @Tenant
AND LegalEntityId = @LegalEntityId
AND LastName = @LastName
AND FirstName = @FirstName
AND EMail = @EMail)
WHERE IdUser = (SELECT IdUser FROM Inserted)
END
but I cannot figure how to use a trigger to update a collection and not find anything on it, any help welcome
I use Windows Identity Foundation in my code and update or insert can set multiple rowsHello and thanks for help.
The trigger i give as example already works fine but Fanny Liu is for sure better than mine and I will try it. Users insertions are not multiple, only one user can be inserted at the same time
My question was most on using triggers to update a collection via a Join table between my user and users roles
I wrote it Yesterday for INSERT
USE [TEST_MULTI]
GO
/****** Object: Trigger [dbo].[USER_ROLE_INSERT_REPLICATION] Script Date: 01/03/2014 10:56:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:
-- Create date: 2014/02/01
-- Description: Replication INSERT on MASTER DATABASE
-- =============================================
ALTER TRIGGER [dbo].[USER_ROLE_INSERT_REPLICATION]
ON [TEST_MULTI].[dbo].[DM_USER_JOIN_USER_ROLE]
AFTER INSERT
AS
DECLARE InsertCursor CURSOR FOR (SELECT FKUser, FKUserRole FROM inserted)
DECLARE @UserId int, @UserRoleId int
OPEN InsertCursor
FETCH NEXT FROM InsertCursor INTO @UserId, @UserRoleId
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @UserMasterId int = (SELECT ExtIdUser FROM TEST_MULTI.dbo.DM_USER WHERE IdUser = @UserId)
IF NOT EXISTS(SELECT * FROM DM_SECURITY_MASTER.dbo.DM_USER_JOIN_USER_ROLE WHERE FKUser = @UserMasterId
AND FKUserRole = @UserRoleId)
INSERT INTO DM_SECURITY_MASTER.dbo.DM_USER_JOIN_USER_ROLE (FKUser, FKUserRole) VALUES (@UserMasterId, @UserRoleId)
FETCH NEXT FROM InsertCursor INTO @UserId, @UserRoleId
END
CLOSE InsertCursor;
DEALLOCATE InsertCursor;
And for DELETE
USE [TEST_MULTI]
GO
/****** Object: Trigger [dbo].[USER_ROLE_DELETE_REPLICATION] Script Date: 01/03/2014 10:57:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:
-- Create date: 2014/02/01
-- Description: Replicate DELETE on MASTER DATABASE
-- =============================================
ALTER TRIGGER [dbo].[USER_ROLE_DELETE_REPLICATION]
ON [TEST_MULTI].[dbo].[DM_USER_JOIN_USER_ROLE]
AFTER DELETE
AS
DECLARE DeleteCursor CURSOR FOR (SELECT FKUser, FKUserRole FROM deleted)
DECLARE @UserId int, @UserRoleId int
OPEN DeleteCursor
FETCH NEXT FROM DeleteCursor INTO @UserId, @UserRoleId
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @UserMasterId int = (SELECT ExtIdUser FROM TEST_MULTI.dbo.DM_USER WHERE IdUser = @UserId)
DELETE FROM DM_SECURITY_MASTER.dbo.DM_USER_JOIN_USER_ROLE WHERE FKUser = @UserMasterId AND FKUserRole = @UserRoleId
FETCH NEXT FROM DeleteCursor INTO @UserId, @UserRoleId
END
CLOSE DeleteCursor;
DEALLOCATE DeleteCursor;
It works fine
Thanks for help, I will mark it as answered -
Mapping an object's property to a field computed from 2 database fields
Hi,
Is there a way to do a WorkBench mapping of a business object's property to a field computed from 2 separate database fields?
If not in WB, how would you do that?
Thanks,
MichalYou could define this mapping through a TransformationMapping using you own code in the mappings transformer to divide the values. However you are probably much better off to just map the two values directly, and add a method in your object model to get the rate buy dividing the values.
If terms of being able to order-by the calculated value in the a TopLink query, mapping the calculated value using a transformation mapping would not help this.
To do this order by you can use,
query.addOrdering(ExpressionMath.multiply(ExpressionMath.divide(builder.get("numberOfSuccess"), builder.get("numberOfAttempts")), 100); -
Hello,
can I overwrite database fields in Crystal Reports Designer?
I have reports, which are based on a business view. In this view I have many kpi columns with Euro values. This view also have columns which have stored the local currency.
Until now, the reports only represent the Euro values. The reports should be adapted now, so that conditioned by a parameter either the Euro or local currency will be displayed.
So is it possible to overwrite the existing Euro column value by the local currency value if the corresponding parameter was selected in the following way:
if currency_parameter = 'local' then
Business_View.KPI_1_EURO = BUsiness_View.KPI_1_LOCAL
else
Business_View.KPI_1_EUROHello,
here is the sql output of the two different versions. First one with the old logic (without Currency Conversion, the second one with the new logic). Perhaps then you can find my problem. What I can see which seems to be wrong is, that in the new sql no group function were integrated.
Old:
SELECT TO_CHAR ("DATE"."YEAR"),
SUM ("MONTHLY_TOTAL"."TOTAL_PUBL_COMMISS_OP_EUR"),
FROM (((("DB_LIVE"."V_MART_MONTHLY_TOTAL" "MONTHLY_TOTAL" INNER JOIN "DB_LIVE"."SYS_DATE" "DATE"
ON "MONTHLY_TOTAL"."DATE_ID" = "DATE"."DATE_ID")
INNER JOIN
"DB_LIVE"."DIM_PUBLISHER_VERSION" "PUBLISHER" ON "MONTHLY_TOTAL"."PUBLISHER_ID_VERSION" =
"PUBLISHER"."PUBLISHER_ID_VERSION")
INNER JOIN
"DB_LIVE"."DIM_PROGRAM_VERSION" "PROGRAM" ON "MONTHLY_TOTAL"."PROGRAM_ID_VERSION" =
"PROGRAM"."PROGRAM_ID_VERSION")
INNER JOIN
"DB_LIVE"."DIM_LOCATION_VERSION" "PROGRAM_LOCATION" ON "MONTHLY_TOTAL"."PROGRAM_LOCATION_ID_VERSION" =
"PROGRAM_LOCATION"."LOCATION_ID_VERSION")
INNER JOIN
"DB_LIVE"."DIM_BUSINESS_MODEL" "BUSINESS_MODEL" ON "PUBLISHER"."BUSINESS_MODEL_ID" =
"BUSINESS_MODEL"."BUSINESS_MODEL_ID"
WHERE "MONTHLY_TOTAL"."PERSPECTIVE" = 2
AND "DATE"."MONTH" = 3
AND "PROGRAM_LOCATION"."LOCATION_ID" = 10
AND "DATE"."YEAR" = 2011
GROUP BY TO_CHAR ("DATE"."YEAR"),
"DATE.MONTH",
"PROGRAM_LOCATION"."NAME"
NEW:
ORAPROD.WORLD
select
decode({?Currency},1,CLK_PUBL_COMMISS_OP, CLK_PUBL_COMMISS_OP_EUR) CLK_PUBL_COMMISS_OP_EUR,
u2026
from
DB_LIVE.V_MART_MONTHLY_TOTAL
EXTERNAL JOIN MONTHLY_TOTAL.DATE_ID={?ORAPROD.WORLD: DATE.DATE_ID} AND MONTHLY_TOTAL.PUBLISHER_ID_VERSION={?ORAPROD.WORLD: PUBLISHER.PUBLISHER_ID_VERSION} AND MONTHLY_TOTAL.PROGRAM_ID_VERSION={?ORAPROD.WORLD: PROGRAM.PROGRAM_ID_VERSION} AND MONTHLY_TOTAL.PROGRAM_LOCATION_ID_VERSION={?ORAPROD.WORLD: PROGRAM_LOCATION.LOCATION_ID_VERSION}
ORAPROD.WORLD
SELECT
FROM ((("DB_LIVE"."SYS_DATE" "DATE" CROSS JOIN "DB_LIVE"."DIM_PUBLISHER_VERSION" "PUBLISHER") CROSS JOIN "DB_LIVE"."DIM_PROGRAM_VERSION" "PROGRAM") CROSS JOIN "DB_LIVE"."DIM_LOCATION_VERSION" "PROGRAM_LOCATION") INNER JOIN "DB_LIVE"."DIM_BUSINESS_MODEL" "BUSINESS_MODEL" ON "PUBLISHER"."BUSINESS_MODEL_ID"="BUSINESS_MODEL"."BUSINESS_MODEL_ID"
WHERE "DATE"."DATE_ID"={?ORAPROD.WORLD: MONTHLY_TOTAL.DATE_ID} AND "PUBLISHER"."PUBLISHER_ID_VERSION"={?ORAPROD.WORLD: MONTHLY_TOTAL.PUBLISHER_ID_VERSION} AND "PROGRAM"."PROGRAM_ID_VERSION"={?ORAPROD.WORLD: MONTHLY_TOTAL.PROGRAM_ID_VERSION} AND "PROGRAM_LOCATION"."LOCATION_ID_VERSION"={?ORAPROD.WORLD: MONTHLY_TOTAL.PROGRAM_LOCATION_ID_VERSION} AND "DATE"."MONTH"=3 AND "PROGRAM_LOCATION"."LOCATION_ID"=10 AND "DATE"."YEAR"=2011 -
Update of non-database fields mapped to database fields
I have two columns start month and start year which
are non-database columns and which map to one database
field start date in the database.
I have a post-query trigger on the start month and
start year fields to derive the value from the
database field start date when the form is queried.
When I try to update the form, the update does not
work - if I remove the post-query trigger then the
update works but, the month and year non-database
fields do not get queried.
Any help will be greatly appreciated.
Thanks,
Suzannesince those 2 fields are not connected to the database field you need to code the update to the database.
Use the pre-insert trigger and set the value of the date item according to the values of the 2 fields. -
I have two form fields getting their record from a data base, they both get numbers, and in the same form, I would like to add a third field, and then get it value by putting the two other fields together,
Here is what I want:
I have:
x = field one (get value from database, Number)
y = field two (get value from database, Number)
I would to have as final result:
z (form field three) = x + y
Java or whatever else that work, (I am using Dreamweaver CS5)
thanksI assume that you are working with a server side code in which case just use that.
For instance, if using PHP the example would look like
<?php /* the following values will be obtained from the database*/
$rowDatabase['x']=53;
$rowDatabase['y']=104;
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<input name="x" type="text" readonly="true" value=<?php echo $rowDatabase['x']; ?> /> +
<input name="y" type="text" readonly="true" value=<?php echo $rowDatabase['y']; ?> /> =
<input name="z" type="text" readonly="true" value=<?php echo $rowDatabase['x']+$rowDatabase['y']; ?> />
</body>
</html> -
I have two Database. One the master databse is Oracle 7.3 and another Oracle 8.06. Now i want to update a field in Oracle 8.06 from Oracle 7.3. These updation also has to be done for the new records created. How i can do.
May be using create database link!
-
Conversion of Char database fields to Date Object view attributes
Hello,
I would like to transform all date values of data type CHAR(10) in an oracle database (formatted like this : "YYYY/MM/DD") to oracle.jbo.domain.Date fields.
For the moment the better idea I have found is :
- add transcient entity attributes (type oracle.jbo.domain.Date) for each persistent attributes (type oracle.jbo.domain.Char) representig a date field in each Entity object of my application.
- in the java code of the Getter and Setter method of those transcient attributes, I call a method which transform a value of type "oracle.jbo.domain.Char" to a
"oracle.jbo.domain.Date" (for the Getter), and an other method which transform a value of type "oracle.jbo.domain.Date" to a
"oracle.jbo.domain.Char" (for the Setter)
The aim of these transformations is to retrieve those transient attributes of oracle.jbo.domain.Date type in my web application in order to easily associate them to adf "input date" components : what I have undersand is that this "input date"component is waiting for a "Date" type in input to work properly.
But I find that it is a lot of work to do. I have maybe 100 database fields concerned by those conversions.
Does it exist something in the Adf framework between the database and the "adf entity objects", or between the "adf entity objects" and the "adf view objects", where I can declare to make these transformation for all my database pseudo date fields : something like a class-converter in the adf web framework where I can say, for example, to execute some methods in order to transforms the concerned data in two directions : "Char to Date" and "Date to Char".
Thanks for your help.Hello,
I would like to transform all date values of data type CHAR(10) in an oracle database (formatted like this : "YYYY/MM/DD") to oracle.jbo.domain.Date fields.
For the moment the better idea I have found is :
- add transcient entity attributes (type oracle.jbo.domain.Date) for each persistent attributes (type oracle.jbo.domain.Char) representig a date field in each Entity object of my application.
- in the java code of the Getter and Setter method of those transcient attributes, I call a method which transform a value of type "oracle.jbo.domain.Char" to a
"oracle.jbo.domain.Date" (for the Getter), and an other method which transform a value of type "oracle.jbo.domain.Date" to a
"oracle.jbo.domain.Char" (for the Setter)
The aim of these transformations is to retrieve those transient attributes of oracle.jbo.domain.Date type in my web application in order to easily associate them to adf "input date" components : what I have undersand is that this "input date"component is waiting for a "Date" type in input to work properly.
But I find that it is a lot of work to do. I have maybe 100 database fields concerned by those conversions.
Does it exist something in the Adf framework between the database and the "adf entity objects", or between the "adf entity objects" and the "adf view objects", where I can declare to make these transformation for all my database pseudo date fields : something like a class-converter in the adf web framework where I can say, for example, to execute some methods in order to transforms the concerned data in two directions : "Char to Date" and "Date to Char".
Thanks for your help. -
Synchronisation of data between two databases
i have two databases having tables with same fields and i would like to transfer the data from one database to the other , how do i do that? is there any link which talks about synchronisation of data between two databases?
Make the database name same in both databases and use Veritas tools for data copy.
Maybe you are looking for
-
Newsstand app - how to make it?
Hello, I have a big problem with our first app for newsstand in iTunes Connect. The app is a multi-issue app and the magazine should be published every three month for free. I hope somebody can give me a step-by-step introduction, because in the iTun
-
How to find EXIT where a Extension is getting filled?
Hi All, I have a IDoc extension and its segments are getting filled from an EXITs, Since this IDoc is getting triggered by output type so only use EXITs to fill the custom segments. Please guide me how to find the EXIT where segment of this extensio
-
Best Practice Buttons? and Swing Button Sizes
Hi, I am wondering what the best way to make a custom styled button was.... Since I need my own style of button (width,height,background image, selected, clicked) I thought I would use Swing buttons with a Synth style. However, when I place swing but
-
URGENT: Delivery with multiple line items for a STO
Hi Gurus, We ar ecreating deliveries using VL10b for a STO. Teh TSO has 40 - 50 line items. But the delivery is created with one line item only an dit creates a delivery for each line item. How cna we allow the inclusion of multiple line items in del
-
I am just beginning to learn Dreamweaver CS3 and am having trouble copying and pasting. I am trying to copy an image from one page to another but it doesn't paste. Using Edit/paste the paste option is not greyed out. Background: I have used Word and