Insert new rows based on user selection on a table display on the screen
Hi..
In my requirement i need to display the line items of a PO# to the user on the screen for specific fields. Each row should also include an additonal checkbox when displayed for the user. When the user checks this check box or clicks on it a new row should be inserted below to that row with the existing data of that row being copied to newly inserted row and allowing the user to make any changes.
The newly inserted row should also include a check box , so that when the user checks it again a new row should get inserted. Finally what ever data user enters on the screen, i should be able to update my internal table with those new values and records.
Appreciate if anyone can guide me on how to proceed on this or any alternative approaches.
Will reward helpful answers.
Thanks.
Hi ..
Can you please be more detailed. First I need to know how to create the initial table display for the existing line items and then the techniques for inserting the new rows based on the check marks and finally add those news rows to my existing internal table..
Appreciate ur help.
Thanks.
Similar Messages
-
How to HIde rows based on User Selection
I have a requirement where in I have to hide some rows based on Plant Name selected by USer at the time of opening the report.
Here is the screen shot:-
Here I am seeing two Tag Types MACT and Average when User selects Luling Plant. But When User selects some other Plant I don't want to see Tag Type 'MACT' in this table.
We have a predefine filter for Plant.
How can I achieve that. The data in White Rows is Average values.
Please help.
RegardsHi Shalini,
Is user selecting Plant Name from the report prompt. If Yes, then try below-
Create a variable-
FilterSelect= If UserResponce("WritePromptTextHere") =" Luling Plant" and TagType inList ("MACT";"Average") Then 1 ElseIf UserResponce("WritePromptTextHere") <>" Luling Plant" and TagType inList ("MACT";"Average") Then 3 Else 2
Apply Filter on "FilterSelect" variable-
FilterSelect=1 and 2
~Anuj -
Very Common Scenario - Insert new Rows whose primary Key is not in View Obj
Question : How can you add new records when the primary key of the records are not present in view ? I am facing infinite loop for the below logic .
The View Object is derived from 2 entity object (tableA,tableB) . The view has created in such a way that tableA data is updatable and tableB is read only. The view contains all the unique records of tableA and tableB . i,e the SQL query returns all the existing records from tableA , and those are not in tableA picks from tableB . Therefore , the Sql Query returns the primary key of tableA as 0 for the records which are not present in tableA but exist in tableB .
there fore My sql qery like below
select A.P_ID, A.mapping_id, A.dataValue FROM tableA A
UNION select 0 P_ID , B.mapping_id , 0 dataValue From tableB B ;
Now my challenge is how can to add those new records that taken from table B and insert to TableA ? I am getting an infinite loop for the below logic -
Below code has been written in my Managed bean -
public void addNewSelectedMappings(){
DCBindingContainer dcb = (DCBindingContainer)evaluateEL("#{bindings}");
DCIteratorBinding dciter =
dcb.findIteratorBinding("CustomView1Iterator");
ViewObject vo = dciter.getViewObject();
Row row = null;
while ((row = vo.getCurrentRow()) != null)
Number mappingId =
(oracle.jbo.domain.Number)row.getAttribute("mappingId");
java.lang.Number dataValue = ( java.lang.Number)row.getAttribute("dataValue ");
if(mappingId .equals(0)){
BindingContext bindingContext = BindingContext.getCurrent();
BindingContainer bindings = bindingContext.getCurrentBindingsEntry();
// call the client interface defined in the AM
OperationBinding methodWithArgs = (OperationBinding) bindings.get("insertNewRow");
//add argument
methodWithArgs.getParamsMap().put("mappingId",mappingId);
methodWithArgs.getParamsMap().put("dataValue ",dataValue);
methodWithArgs.execute();
vo.next();
Below code in my application module to execute -
+public String insertNewRow(oracle.jbo.domain.Number mappingId , java.lang.Number dataValue){+
+try{+
SequenceImpl seq = new SequenceImpl("TableA_ID_SEQ", getDBTransaction());
oracle.jbo.domain.Number seqNextval = seq.getSequenceNumber();
System.out.println(" seqNextval " seqNextval);+
ViewObject vo = this.getCustomView1();
Row r = vo.createRow();
r.setAttribute("P_Id", seqNextval);*
r.setAttribute("mappingId ", mappingId );
r.setAttribute("dataValue", dataValue);
vo.insertRow(r);
this.getDBTransaction().commit();
+} catch (oracle.jbo.TooManyObjectsException tmoe) {+
System.out.println(" eorrr......"tmoe);+
return "error";
+} catch ( RowAlreadyDeletedException rd) {+
System.out.println(" Inside RowAlreadyDeletedException ");
return "RowAlreadyDeletedException";
+}+
return "success";
+}+Hi ,
Can some one please help me out . Just to simplify the question , I have a mappings table and a Master table .
All the user selected items should save in the Mapping table . let say , there is a table name Products . User selects the products and that should save in the User product mapping table .
I want to show the user selected products and available products in a single view . also , want to update the mappings table based on user selection .
i m using jdev 11.1.1.5 . -
I can't insert new row in database when there is a secondary key.
hi experts. I am using Jdeveloper since a while. I would like to know If there is a way to insert a new row with secondary key attribute in database. As example if we have a sessionEJBLocal data control can't we add new row by using single selection choice item for secondary key attributes? I tried to use single selection even jdbc with sql queries in a managed bean but nothing. Can you help me please?
would this solve your problem
http://kohlivikram.blogspot.com/2008/10/add-new-row-in-adf-table-on-button.html -
Split Oracle 11g Table Partition and Insert new rows
Hi,
I have a doubt that i would like to be clarified. I need to split a partition of a table with more than 800 Million records, but at the same time (during the split operation) i need to insert new records (not in the partition that is being splited). Is there any problem/risk doing this? Is the insert ETL process going to fail ?
Thanks in advance
Greetings.
Nuno
Edited by: user13512889 on 1/Set/2011 3:25Hi Enrique,
Thanks for posting in MSDN.
Based on the description, you want to modify the formula for the A1 and B1 cell when you insert a new rows.
Yes, we can use Worksheet.Change to dermin the change of data on the worksheet then we can modify the formula as we wanted. Here is a sample for your reference:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.Range("A1").Formula = "=MAX($A2:$A" & Me.UsedRange.Rows.Count & ")"
Me.Range("B1").Formula = "=MIN($B2:$B" & Me.UsedRange.Rows.Count & ")"
End Sub
You can more detail about Excel VBA developing from link below:
Getting Started with VBA in Excel 2010
Welcome to the Excel 2013 developer reference
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Min and Max and insert new rows
Hello,
I am really a beginner in Excel (2007). I am not sure if this is the correct forum, anyway.
I have grouped some rows in a sheet (rows 1, 2 and 3, columns A and B, table below), some of the columns have numeric values in that group and I have a row (inside that group) that shows the maximum and minimum values (row 1):
A B
+ 1 43 12 <- MAX and MIN values for row 2 and 3 columns A and B
+ 2 34 12
+ 3 43 34
I am using MAX and MIN functions: A1 = MAX($A2:$A$3), B1 = MIN($B$2:$B$3)
The problem comes when I want to insert more rows after row 3, the formula keeps wrapping to A$2:$A$3 therefore I need to readjust the formula to: MAX($A2:$A$4) manually (for MIN is the same).
A B
+ 1 43 12 <- Are the same, they should be
"98 and 10"
+ 2 34 12
+ 3 43 34
+ 4 98 10 <- New row, but the maximum and minimum continues to be the same, I want to extend the formula automatically to the 4 row when I insert the new row.
Question:
How can I extend the function of the MAX and MIN formula automatically when I insert new rows?
Please consider that I may insert rows at the beginning, in the middle or the end.
Thanks,
Enrique.
Kikeman Electric Systems EngineerHi Enrique,
Thanks for posting in MSDN.
Based on the description, you want to modify the formula for the A1 and B1 cell when you insert a new rows.
Yes, we can use Worksheet.Change to dermin the change of data on the worksheet then we can modify the formula as we wanted. Here is a sample for your reference:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.Range("A1").Formula = "=MAX($A2:$A" & Me.UsedRange.Rows.Count & ")"
Me.Range("B1").Formula = "=MIN($B2:$B" & Me.UsedRange.Rows.Count & ")"
End Sub
You can more detail about Excel VBA developing from link below:
Getting Started with VBA in Excel 2010
Welcome to the Excel 2013 developer reference
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Insert new row to master - detail form using bindingsource
Hi all,
I have a form to analyse price of product, the form include master (textbox:slip ID,datetimepicker : date) and detail(datagridview:slipID,productID,price..)
When I insert new row as below code, all inserted to DB but not show on form, I must close and reopen the form the new row will show, how i must to do to fix it
please help, thanks
Select data when form load
ds = New DataSet
damaster = New SqlDataAdapter("select soPTG,ngaybd,ngaykt,khoa = case when sttesign =0 then 'True' else 'False' end from tbl_PTGMaster", conn)
damaster.Fill(ds, "tbl_ptgMaster")
dadet = New SqlDataAdapter("select [SoPTG],[Mahang],[gianhap],[thuesuat],[laigop],[giacu],[giamoi] from tbl_PTGDetail", conn)
dadet.Fill(ds, "tbl_ptgdetail")
ds.Relations.Add("PTG_rel", ds.Tables("tbl_ptgmaster").Columns("SoPTG"), ds.Tables("tbl_ptgdetail").Columns("SoPTG")).ChildKeyConstraint.UpdateRule = Rule.Cascade
BindingMaster.DataSource = ds
BindingMaster.DataMember = "tbl_ptgmaster"
BindingDetail.DataSource = BindingMaster
BindingDetail.DataMember = "PTG_rel"
gridchitiet.DataMember = "tbl_ptgdetail"
txtptgnumb.DataBindings.Add("text", BindingMaster, "soPTG")
dtstart.DataBindings.Add("Text", BindingMaster, "ngaybd")
dtend.DataBindings.Add("Text", BindingMaster, "ngaykt")
cmdlock.DataBinding.Add("Enabled", BindingMaster, "khoa", True, DataSourceUpdateMode.OnPropertyChanged)
setStatus()
SetHeader()
Dim cmdinsert As New SqlCommand("insert into tbl_PTGMaster(SoPTG,ngaybd,ngaykt) values(@SoPTG,@ngaybd,@ngaykt)", conn)
cmdinsert.Parameters.Add("@soPTG", SqlDbType.Char, 10).Value = txtptgnumb.Text
cmdinsert.Parameters.Add("@ngaybd", SqlDbType.DateTime).Value = dtstart.Value
cmdinsert.Parameters.Add("@ngaykt", SqlDbType.DateTime).Value = dtend.Value
damaster.InsertCommand = cmdinsert
damaster.FillSchema(ds, SchemaType.Source)
cmdinsert = New SqlCommand("insert into tbl_PTGDetail(SoPTG,mahang,gianhap) values(@SoPTG,@mahang,@gianhap)", conn)
cmdinsert.Parameters.Add("@SoPTG", SqlDbType.Char, 10).Value = txtptgnumb.Text
cmdinsert.Parameters("@SoPTG").Direction = ParameterDirection.InputOutput
cmdinsert.Parameters.Add("@mahang", SqlDbType.Char, 10, "mahang")
cmdinsert.Parameters.Add("@gianhap", SqlDbType.Decimal, 8, "gianhap")
dadet.InsertCommand = cmdinsert
dadet.FillSchema(ds, SchemaType.Source)
gridchitiet.FinishEditing()
BindingMaster.EndEdit()
damaster.Update(ds, "tbl_PTGMaster")
ds.Tables("tbl_PTGMaster").AcceptChanges()
BindingDetail.EndEdit()
dadet.Update(ds, "tbl_PTGDetail")
ds.Tables("tbl_PTGDetail").AcceptChanges()
BindingMaster.ResetBindings(False)
BindingDetail.ResetBindings(False)Hello,
The base idea here is if the record is added successfully you would then get the new primary key then manually add the record to the underlying data source. Does not matter if we are talking a single table or a master-detail setup.
The following shows the basics
https://code.msdn.microsoft.com/Adding-new-records-into-bff5eaaf
All of the above is done without using a DataSet yet the same thing needs to happen with a DataSet, simply focus on the one table.
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. -
ODI - SCD Type 2 - Insert new row error
Hi All,
For Dimension I have a surrogate key, a natural key, and a column with "overwrite on change", start_date, end_date, current_record_ind. When I run the interface with the default SCD Type 2 for SQl server, this runs fine. But when I change that one column from "overwrite on change" to "insert new row", it fails on the update step. What should I be looking for anf fixing.
Thanks for your time and help.DB: SQL Server 2008.
IKM = IKM MSSQL Slowly Changing Dimension
Error Message: ODI-1228 - Incorrect syntax near the keyword from.
Code: update T
set
from database.dbo.Dim_type as T,
database.dbo.I$_Dim_type as S
where T.Cd = S.Cd
and T.Current_rec_ind = 1
and IND_UPDATE = 'U'
To overcome the issue, I have commented the update code in the Knowledge module and the insert works, but for this one it is ok, but I have requirements where one column needs to be overwritten and other column changes will require to add a new record. How to handle both?
Thanks for your time. -
How to create dynamic ed flash charts based on user selected fields in Orac
Hi all,
Can any of the experts please tellme "how to create dynamic ed flash charts based on user selected fields in Oracle apex".
Thanks
ManishHello,
Lots of different ways to do this, I blogged about one way (using a Pipelined function) here -
http://jes.blogs.shellprompt.net/2006/05/25/generic-charting-in-application-express/
Other options include using a PL/SQL function returning the string to use as the dynamic query etc.
Hope this helps,
John.
Blog: http://jes.blogs.shellprompt.net
Work: http://www.apex-evangelists.com
Author of Pro Application Express: http://tinyurl.com/3gu7cd
REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone! -
Output different data based on user select
Hi everyone,
Quick question, I would like to output different report columns based on user select, eg., users would be presented with two choices in a radiobutton list, eg., 1 and 2.
I have query results that contain columns A, B, C, D, E, F, G.
If user selects 1 then the output should be columns A, B, C, D, E.
If user selects 2 then the output should be columns A, B, C, F, G.
I am sure this is possible and easy? If so, what topic should I be reading/searching internet on?
Please advise.
Thanks!I would say that this is most often something that your user interface should be dealing with (i.e. which columns should be shown).
There is no way to do that in SQL.
In PL/SQL it is a simple situation of creating two cursors and simply deciding which one to open.
<pre>declare
l_cur sys_refcursor;
begin
if :user_selection = 1 then
open l_cur for select A, B, C, D, E from tbl;
else
open l_cur for select A, B, C, F, G from tbl;
end if;
-- use the cursor
close l_cur; -- or return to user interface
end;
/</pre>
Hope this helps. -
[MDX] Define date range based on user selection
Hi All,
I'm trying to define date range (of 3 months) using mdx based on user selection.
This is what I'm trying to do:
- If user select 2013, I would like range to be: from
1 Oct 2013 to 31 Dec 2013
- If user select Aug 2013, I would like range to be: from
1 Jun 2013 to 31 Aug 2013
- If user select 15 Sep 2013, I would like range to be : from
15 Jul 2013 to 15 Sep 2013
It is not a problem to get the upper bound of the range like this:
ClosingPeriod(
[Date].[Calendar].[Date],
[Date].[Calendar].CurrentMember
But I'm not able to get the lower bound of the range:
OpeningPeriod(
[Date].[Calendar].[Date],
ParallelPeriod(
[Date].[Calendar].[Month Number],
2,
ClosingPeriod(
[Date].[Calendar].[Date],
[Date].[Calendar].CurrentMember
Error:If user selection is
15 Aug 2013, I get
14 Jun 2013
If user selection is Apr 2013, I get
(null)
And even more strange, if user selection is
2013, I get 28 Oct 2013
Any idea of how to solve this ?
Thanks,
GuillaumeHello Guillaume,
Can you please check if the following works for you? By the way, the performance will suffer due to all these IIF, the solution is very complex in order to avoid null in ParallelPeriod.
with member measures.high as MemberToStr(ClosingPeriod(
[Date].[Calendar].[Date],
[Date].[Calendar].CurrentMember
member measures.low as
MemberToStr(
iif(ClosingPeriod(
[Date].[Calendar].[Date],
[Date].[Calendar].CurrentMember
) IS ClosingPeriod(
[Date].[Calendar].[Date],
[Date].[Calendar].CurrentMember
).Parent.LastChild --last date of the month
OpeningPeriod(
[Date].[Calendar].[Date],
Ancestor(ClosingPeriod(
[Date].[Calendar].[Date],
[Date].[Calendar].CurrentMember
), [Date].[Calendar].[Month]).lag(2)
iif([Date].[Calendar].CurrentMember.level is
[Date].[Calendar].[Date]
and
Right(CSTR([Date].[Calendar].CurrentMember.Properties("KEY0")),4)="0429" --take care of 4/29
OpeningPeriod(
[Date].[Calendar].[Date],
Ancestor(ClosingPeriod(
[Date].[Calendar].[Date],
[Date].[Calendar].CurrentMember
), [Date].[Calendar].[Month]).lag(2)
OpeningPeriod(
[Date].[Calendar].[Date],
ParallelPeriod(
[Date].[Calendar].[Month],
2,
ClosingPeriod(
[Date].[Calendar].[Date],
[Date].[Calendar].CurrentMember
select {measures.low,measures.high } on 0
from [Adventure Works]
where
--[Date].[Calendar].[Date].&[20070815]
--get [Date].[Calendar].[Date].&[20070615]
--[Date].[Calendar].[Date].&[20070530]
--get[Date].[Calendar].[Date].&[20070330]
--[Date].[Calendar].[Date].&[20070429]
--get [Date].[Calendar].[Date].&[20070201]
--[Date].[Calendar].[Calendar Year].&[2007]
--get [Date].[Calendar].[Date].&[20071001]
--[Date].[Calendar].[Month].&[2007]&[4]
--get [Date].[Calendar].[Date].&[20070201]
--[Date].[Calendar].[Month].&[2007]&[5]
--get [Date].[Calendar].[Date].&[20070301]
--[Date].[Calendar].[Date].&[20070228]
--get [Date].[Calendar].[Date].&[20061201]
--[Date].[Calendar].[Date].&[20070831]
--get [Date].[Calendar].[Date].&[20070601]
If this does not work for you, I would suggest opening a ticket with Microsoft Support, with an advisory type of request.
Hope this helps.
Thanks.
Meer Al - MSFT -
I have restored my iphone 3gs after having only the apple logo, it took me through all the restore, a page saying 'congrats your phone is now unlocked', and allowed me to chose to set up from new or back up....yet still displays only the apple logo.
Restore as New...
Redownload your Purchased and Free Apps using the Apple ID you Originally used...
iPhone User Guide
http://manuals.info.apple.com/en_US/iphone_user_guide.pdf -
My old iMac and OS 10.4 will not accept the New iTunes Version 10 application and I can't get past the screen offering to download iTunes 10. This is wrong and I need help getting past this situation. Help!
Sure, you can get around it if you don't need the newest version of iTunes. I still use version 7.5 because the newer versions didn't strike me as offering anything I needed.
If you do need a version 10-something then you will have to upgrade your operating system to Leopard (fi your computer will support it) at least. If you need 10.5 for some reason then there's no getting around it, you will have to buy a new computer. -
How to update records in a table based on user selection..
Hi all,
This time the above doubt is totally based on the logic of coding which I tried a lot but didn't get any solution. so atlast I come to sdn site.
please help..
The requirement is like that I have a table with 6 fields (1 primary key and other are nonkeys). If the user inputs some values in the fields on the screen, then a row will be added in the table. Upto this i have done well. but when the user want to change some value in the existing row of the table my program unable to do so. Because I couldn't get any logic to do that as there are 5 nonkey fields, so if any one field is modified then the respective row should be selected first based on the user selection and then it should be updated.
At this point I could not get any idea as it may take a lots of if conditions (I guess) to reach to that particular row.
Please help..
thanks ,
sekharHi Sekhar,
I am afraid, the whole design of your program is wrong, let me explain
Let us say you have two rows(5 non key fields) that the user wants to update and the data in these five non key fields are identical and in your program you are getting a number(which is the key) using a number range object. So you will have two entries in the table for the same data.
And on the update page when the user enters the non key fields, how will the program know(or for that matter any one of us) which record to pick, if you have two identical books and if asked for a book wouldn't you ask which one among these two do you want?
Possible Solution: Identify a possible key maintaining the integrity of the data, that is a combination of the non key fields which will help you identify a unique row and make these fields as key fields in the table.
A more costly solution(if you do not want to change the non key field keys to key fields) would be to, adding a check(using select statement) to see if the non key fields combination already exists in the Z table before inserting a record into the table.
If yes, throw a message to the user and just update the values in the table, else insert the record.
Another solution would be to, use the non key fields to generate a key(using some logic) and using this instead of the number range object.
regards,
Chen -
How to insert new row in MIGO using badi.
hi,
Transaction code: MIGO. i'm using badi "MB_MIGO_BADI" and method "LINE_MODIFY", i want to insert N number of item lines when user entered any production order no. and press enter.
Notes: production order has only one item line with qty N.
regards,
Shahid RaisSuch a feature is not available, but you could add a key event handler which works its magic when it detects a press on the down arrow key, while the last row is selected. Then you can perform the code to insert a new row.
Maybe you are looking for
-
HR LDB PNP and customer infotypes in 640
Hello, I encountered the following problem during an upgrade from 4.6C to SAP ERP Central Component 5.0. When using logical database PNP and customer infotypes the syntax check produces the following syntax error: - INCLUDE report "%_HR9731" not foun
-
Bluetooth and Plantronics Legacy random disconnect issues
I've been using the latest MAXX with the latest Plantronics Legacy headset. Randomly, bluetooth will disconnect, the call will remain active but does not automatically failover to either handset or speaker option (literally the call is active and I'
-
Wear leveling count Samsung SSD 256gb
Hi guys I have a 2011 Mba (core i7 and got lucky getting the 256gb ssd from Samsung on my Mac-), It is my first Mac after 14 years of PCs with Windows. I am not sure about the "wear leveling count" on the drive. Neither am I sure about the program I
-
I've Been having trouble with my Mac computer. It doesn't restart. I'm stuck at the white screen with the grey apple and the spinning lines
-
Does MBP need to be connected to internet at initial setup?
Will it cause trouble to set up the internet connection later? macbook pro 2.16GHz Mac OS X (10.4.6)