How to auto insert computed value when new data is created??
I'm new to APEX and was trying to solve this:
To make it simple: I have a table, square_table, with two fields: input_number and square_value.
All I want to do is when a user enters an input_number from 'the form and report template', the squared value is automatically computed and saved along with the new number to the square_table.
Would someone post a solution (as details as possible, pls :)? I have watched numerous tutorials and no luck.
Many Thanks,
Poor design. You should not do this, even for strictly educational purposes. Stick to 3NF as much as possible, and only denormalize if a)you REALLY REALLY REALLY need to do it, AND b)your denormalized design survives peer review, AND c)you document VERY WELL the rationale behind such a design. Please read this - look for "Calculated Values".
Anyway. You could do this at least two ways:
1) Create a Page Process in your APEX application. Not a good idea, as other sources of INSERTs (sqplus, client/server apps) will not do the calculation unless coded to do so, and doing so would create multiple points of maintenance and documentation and testing, no to mention the added complexity of dealing with several potential development environments; or
2) Create a good old plain trigger.
If this was not a flawed design, I'd go for (2). It is basic SQL homework, well documented and simple to implement.
Regards,
Georger
user11288935 wrote:
I'm new to APEX and was trying to solve this:
To make it simple: I have a table, square_table, with two fields: input_number and square_value.
All I want to do is when a user enters an input_number from 'the form and report template', the squared value is automatically computed and saved along with the new number to the square_table.
Would someone post a solution (as details as possible, pls :)? I have watched numerous tutorials and no luck.
Many Thanks,
Similar Messages
-
How to read serial port only when new data has been sent to it
I've written this very simple vi to read the serial port whenever the MKS Helium Detector sends a new value. The timing of new data is controlled directly from the front panel of the MKS instrument. I thought it was as simple as looking at the "bytes at port", and reading the port only if the value is not zero. The problem I'm having is that the read function is occuring whether I want it to or not. Consequently, the "Scan from String" function is returning an error (0) once in a while, because it's reading the serial port as it's being updated (I think). Apparently, when the port is in the process of being updated, it is not zero. Anyway, I'm assuming there is a simple fix, but I'm having no luck finding the Easter egg. Any help would be, as always, very much appreciated.
Attachments:
MKSRead.vi 55 KBYou can approach your problem in a couple of ways. The way you've got it written now, as soon as the number of bytes is non-zero, you read and convert. This means that when a partial string is there, you conversion is nor correct. One way is to wait until non-zero bytes like you do now, and then in another loop, read until the byte count is equal to zero and then do the conversion. You can also read until the cr\lf is detected and then do the conversion on the string. You can also enable the termination character for the read but then you'll have to increase the number of bytes to read to something other than just the number of bytes first available. If the instrument always returns the same number of bytes, you can use that as a constant for the VISA Read. Then the read will terminate whenever the byte count OR the termination character is detected.
I modified your VI to show you how you might put it in a loop and what for the CR/LF to be detected. You would want to add a timeout to this so that if the character does not show up, the loop will not run infinitely
Attachments:
MKSRead_mod.vi 68 KB -
Copy values when new action is created
Hi,
In ERP with SAPgui there was nice feature : when one document was created with reference most data were copied (and in customizing it was possible to set what exactly should be copied).
In CRM Webclient UI I have following problem:
1. If I check in WebClient customer contact and I go to assignment block "Planned Activities" and click on NEW button
2 I create a new appointment.
3. Some data (like Contact) are filled but some are missing (like Account for which Contact was created).
I would like to have "Account" information automatically taken from Contact (if contact has reference to account).
I don't think its something to be customized (SPRO), but rather to be developed for UI component.
When I searched for a solution I found this topic:
[Data transfer from one component to another component|Data transfer from one component to another component]
Could anybody confirm the correct approach to have some values populated when something is created with reference (like described in this example).
thank you for any suggestions
regards
RafalHello Rafal,
First of all you should know that to determine the "ATTENDEES", the system runs through the following steps:
1) Read all partners of the business transaction.
2) Keep those BP with a partner function assigned to partner function category 0005, 0007, 0008, 0010 or 0032. You can see it in method ATTENDEES of class CL_CRM_PARTNER_RUN_BTIL.
3) Also you should know that assignment of partner function to partner function category is done in the following IMG:
SPRO >> CRM >> Basic functions >> Partner processing >> Define partner function.
Now according to me, you certainly have a problem with your partner determination procedure: there must be a partner function (linked to one of the category mentioned above) for which you forgot to set a value in "maximum number of occurrences".
Moreover, I think there is a limitation in CRM versions below 7.0: meaning no popup window is displayed to ask the user to choose which partner they want to select in case more than the max number value are found. For example: imagine you set the maximum number of allowed contact person in one document to 5, but 10 are found, the system will automatically select the first 5th for you...
Hope that clarifies the situation a little bit.
Kind regards,
Nicolas Busson. -
Inserting duplicate values when only MANDT is primary key
Hello experts,
I have 4 fields in my UDT(user defined table) namely MANDT, ZEVENT, ZRECIPIENT and ZEMAIL.
Now, Only MANDT is the primary key. My question is, how can I insert duplicate values
via SM30?
Again, thank you guys and take care!Hi again,
1. open the Layout of that screen
2. using drag&drop
just REMOVE the field from the table control.
3. Also
4. In the flow logic of that screen,
remove the line / commen it
which has been put in CHAIN
for eg.
FIELD YHRT_FUNMST-FUNSORT .
5. Activate everything
6. try again via sm30 in new session.
7. NOW IT WILL WORK. I JUST TRIED IT.
regards,
amit m. -
can you give me a example vi for it ?thanks a lot!
how to auto insert a number array with size of 20 into a named excel file with the positon is from A1 TO A20?i use lv6.1You don't need us to give you an example, as the example already comes with LV. Go to Help>>Find Examples and search for "excel". You will find an example called "write table to XL". You should note that the example doesn't do that exactly, because it writes a 2D array from 2 to N.
You can modify the example by using only one for loop (instead of nested loops) with a 1D array or by going into the Set Cell Value and modifying it to accept a second cell value for the Cell2 terminal and wiring in a 1D array instead of the single string. If you do modify it, be sure to save it under a different name, so you don't overwrite the original.
To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
Try to take over the world! -
How to detect when new record is created?
How can I detect when new record is created in PA30? For example, a newly create record for infotype 6 (address).
Can I get the information in PCL4?Hi Irene,
the field PAnnnn-AEDTM, nnnn is the infotype number, will give you the date when the record was last changed.
Not sure if you can precisely get the date when the infotype was created. I dont feel the need to read cluster form the same.
Regards,
Pulkit -
How do i get to know when Person record is created in SAP HR Master Data?
Hi there,
How do i know as and when a person is created/inserted into HR Master data from SAP R/3 SAPGUI? in relation to SAP .NET Connector(SDNC)... Must i use SDNC? or any SAP process? i am new to SAP R/3.
I need that immediate information of the person created so that i can manually create the user in Exchange account using a .NET program. Please advise regarding the part within SAP to external signaling.
Thanks.
Cheers,
Derek TanUnfortunately I can't answer your question directly (you may ask in ABAP-forum if there are some BAPIs that allow you to poll for new users/employees or a user exit that would allow you to do a custom call to an NCo-based RFC server.
However I would suggest you to search for information about the so-called "LDAP-connector" which is part of MySAP and NetWeaver products, and is intended exactly for your kind of scenarios. -
Insert a value of type Date/Time into a database
I am trying to insert a value of type date time into an access database. What is the format needed to insert the date/time.
Thanks,
-AmosI had all kinds of problems getting a datetime inserted into a SQl Server DB. Probably similar so this is what I do:
String date = new String("01/01/97 12:00:00");
stmt.setObject(1, date);
I tried using TimeStamp's but found I got an occasional Fractional Truncation exception back from the driver. Never had a problem inserting a String using the setObject() method though.
Hope this helps -
Excute_query when new date selected from calender
hi,
i have a mater detail form. form is displaying current day values as default.
i put a calendar to form for users can be select date.
now,
i want to excute_query when new date selected from calender.
i writed below code to text_item(calendar) when_validate_item trigger but it nor woring
.giving frm-40137 error.
code is;
:parameter.GUNLUK_TARIH := Name_In('PARAMATRELER.TARIH_SON');
SET_RECORD_PROPERTY(1,'XXMOB_YAPBOZ_TAHTASI_GV',STATUS,QUERY_STATUS);
go_block('XXMOB_YAPBOZ_TAHTASI_GV');
DO_KEY('Execute_query');
any help please
best regards
aykutI was thinking your date selected from CALENDAR ended in a list_item.
I don't know I thinking that
well,
:master_block.itemdate is your text_item where calendar return date selected.
and then , following Gerd's step
Create a WHEN-MOUSE-DOUBLECLICK on the date-item of CALENDAR and write :
begin
:master_block.itemdate := calendar (.........);
go_block ('master-block');
execute_query;
end;
or set a global or parameter variable date selected from calendar :parameter. xxxxxx
in a PRE-QUERY
:master_block.itemdate := :parameter. xxxxxx
and
Create a WHEN-MOUSE-DOUBLECLICK on the date-item of CALENDAR and write :
begin
:parameter. xxxxxx := calendar( ....);
go_block ('master-block');
execute_query;
end;
regards -
How to notifiy to a user when Euipment is automatically created?
Dear All,
How to notifiy to a user when Euipment is automatically created when an asset is created in AS01. I am an Abapper who needs to use a workflow to send the mail to the user to notify the same. If anyone has configured the same , then kindly guide me.
Regards,
FawazYou can try using Powershell
[Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$SSASServerName = "servername"
$SSASDB = "database"
$SSASServer = New-Object Microsoft.AnalysisServices.Server
$SSASServer.Connect($SSASServerName)
$SSASDatabase = $SSASServer.Databases.Item($SSASDB)
$SSASDatabase.Roles | select Role,Members,CreatedTimestamp | where {$_.CreatedTimestamp -gt (Get-Date).AddMinutes(-60)}
--Prashanth -
How to add get Day value in a Date object?
Hi,
I am writing a sql statement that has two date values. One I am getting it from the database. The format in the database is MM/DD/YYYY. My first question is how do I convert the format into the java date format, YYYY-MM-DD. The second question is I need to find out what the day is and add 1 to it. How do I get Day value in a Date object?
Thanks.Look at "SimpleDateFormat" and "parse" in the archives.
-
Can anybody tell me how to restore my computer to an earlier date?
can anybody tell me how to restore my computer to an earlier date?
If you have a Time Machine backup or bootable clone from that date, restore it. If not, you can't.
(112401) -
How to install cs5 w/dvds when new computer has no drives?
How do I install CS5 on my new computer that doesn't have cd/dvd drive, when my cs5 is on DVDs?
You must be on a trial download page to use the links, otherwise you get an error message.
For example, load the following page: http://www.adobe.com/cfusion/tdrc/index.cfm?product=photoshop_elements&loc=us before pasting the link into the address bar.
http://trials2.adobe.com/AdobeProducts/STVD/CS5/osx10/ProductionPremium_CS5_LS7.dmg -
How to copy existing row value into new row with a trigger. Same table
Oracle guru,
I am looking for a before or after trigger statement that will copy existing values inserted in the previous row into columns A & B. Then insert those values in a new row into column A & B if null? Same table. Hopefully my question is clear enough.
-Oracle 10g express
-I have an existing " before insert trigger" that insert id and timestamps when a new row is created.
-Table is composed of column like id,timestamps,A,B and more.
Thanks in advance
Pierre957911 wrote:
Oracle guru,
I am looking for a before or after trigger statement that will copy existing values inserted in the previous row into columns A & B. Then insert those values in a new row into column A & B if null? Same table. Hopefully my question is clear enough.
-Oracle 10g express
-I have an existing " before insert trigger" that insert id and timestamps when a new row is created.
-Table is composed of column like id,timestamps,A,B and more.
Thanks in advance
PierreI will call it a very Wrong design.
It is a wrong Table Design. You are duplicating the data in table and not complying with the Database Normalization rules.
How about Verifying if Column A & B are NULL before inserting and inserting another row and avoiding it in Triggers?
If you are bent to achieve this, below code might be helpful. However, I would never go with this approach. If you would care about explaining the reason for going ahead with such a data model, people could suggest better alternative that might conform with Normalization rules.
create or replace trigger trg_test_table
after insert on test_table
for each row
declare
pragma autonomous_transaction;
begin
if :new.col_a is null and :new.col_b is null then
insert into test_table
select 2, systimestamp, col_a, col_b
from test_table
where pk_col = (select max(pk_col) from test_table b where b.pk_col < :new.pk_col);
end if;
commit;
end trg_test_table;Read SQL and PL/SQL FAQ and post the mentioned details.
Do not forget to mention output from
select * from v$version; -
How to capture the record value, when an error occurs
Hi , can you please help us in achieving the below requirement.
i have source with 10 accounts , i have to update the 5 target tables for the 10 accounts, i am using a for loop to do insert/update operations.
when an primary key/unique constraint error occurs while doing the insert/update operations, i want to catpure that account number along with the
error message and store in a table.
right now i am using sqlerrm,sqlcode in my exception block to capture the oracle error code and error message,i need to capture the account number along with this message. please tell me how to achieve this ...
thanksif you want to log the error in the table and keep going with the rest of them you might want to check out bulk collection exception handling.
http://psoug.org/reference/array_processing.html
CREATE OR REPLACE PROCEDURE forall_errors IS
TYPE myarray IS TABLE OF tmp_target%ROWTYPE;
l_data myarray;
CURSOR c IS
SELECT table_name, num_rows
FROM all_tables;
errors PLS_INTEGER;
dml_errors EXCEPTION;
PRAGMA EXCEPTION_INIT(dml_errors, -24381);
BEGIN
OPEN c;
LOOP
FETCH c BULK COLLECT INTO l_data LIMIT 100;
-- SAVE EXCEPTIONS means don't stop if some DELETES fail
FORALL i IN 1..l_data.COUNT SAVE EXCEPTIONS
INSERT INTO tmp_target VALUES l_data(i);
-- If any errors occurred during the FORALL SAVE EXCEPTIONS,
-- a single exception is raised when the statement completes.
EXIT WHEN c%NOTFOUND;
END LOOP;
EXCEPTION
WHEN dml_errors THEN
errors := SQL%BULK_EXCEPTIONS.COUNT;
dbms_output.put_line('Number of DELETE statements that
failed: ' || errors);
FOR i IN 1 .. errors
LOOP
dbms_output.put_line('Error #' || i || ' at '|| 'iteration
#' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX);
dbms_output.put_line('Error message is ' ||
SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
END LOOP;
WHEN OTHERS THEN
RAISE;
END forall_errors;
/
Maybe you are looking for
-
How do I download previous app purchases?
I am trying to setup my new iPod (latest version) with all of my old data from my previous iPod 4g. This has worked to a certain extent. I have got everything from my old iPod, except for music and apps on the new iPod. I can see all of my music purc
-
Hi, There is no BW upgrade forum so I post my question here. We are going to upgrade SAP BW 3.5 to BI7 soon. Source systems are ECC 5.0 but we plan to upgrade ECC later. (please do not discuss why not upgrade ECC with BW). It was a 3 - 4 months proje
-
Now hat I have my HP6500A Plus connected the fax works great. However my answer machine will no take messages.
-
Duplicate Entries in ADF Tree Hi, Iam facing issue with ADF Tree representation. Getting content from DB. I've a table with self reference. Iam able to provide check box for each node. Following is the usecase of issue a->b->c->1.xml a->b1->c1->2.xml
-
Displaying buttons and other items in french instead of english
Hi, I am new to APEX., which I find incredibly easy to use. Anyway, I am french (nobody is perfect!) and I would like the texts inside the buttons (like 'Create', 'Reset') and in the other part of the aplication ('Edit') to appear in french. BUT with