Horizontal lines for each rows in the rtf template
Hi,
I am a newbie for XML Publisher. I just created a XML Publisher report for Vendor invoices. But for each invoice/invoice line rows I am getting a horizontal line which separates each row. But I just wanted the vertical line to separate the columns and not for the rows.
For example, the output looks like
Invoice number | Item Description| Quantity|
123__________| xyz__________|_____30 |
_____________| xyz__________|_____30 |
_____________| xyz__________|_____30 |
345__________| xyz__________|_____30 |
I am getting the report some this like this. But I need the report like below,
Invoice number | Item Description| Quantity|
123__________| xyz__________|_____30 |
_____________| xyz__________|_____30 |
_____________| xyz__________|_____30 |
345__________| xyz__________|_____30 |
(Please consider the ____ as space)
Please suggest me some solution. tons of thanks in advance.
Hi Vetsrini,
Thanks for your prompt reply. I hope I had put the tag that you had mentioned. But anyhow I had sent your the template and the sample XML file to see the output.
I have one more question also I want a curvey edge for the table and no tthe sharp edge like this _|. If possible please suggest for this also.
Looking forward for your reply.
Hope your mail id is fusion{DoT}object[AT]gmail[dOt]com
Similar Messages
-
How to add a comment for each row on the output of a report?
I would like to add a comment (field) for each row on the output of report? This comment should to be saved as well. Is there a way i can do that?
Regards,
RamHi Dimitri,
through the instead of trigger functionality i am able to update the view. This is view is based on different views which should be linked to a table (as you suggested) in which comments can be stored. Hower this table is empty and how to link this table with the view now? I face the following challenge.
View consists the following columns, for example
select name, sex, age from test_view
name sex age
John M 20
Anton M 30
Willy M 40
shirley F 38
sharon F 37
The report has the following output, for example
name sex age
John M 20
Anton M 30
Willy M 40
Shirley F 38
Sharon F 37
Now i would like to add comment through a button.
The report layout looks like
name sex age
John M 20 <add comment button>
After submitting the <add comment button> you can enter text which deals with John
text='John doesnot like me'
Finally the report display the comment as well
name sex age
John M 20 'John doesnot like me' <update/delete comment button>
Anton M 30 <add comment button>
Willy M 40 <add comment button>
Shirley F 38 <add comment button>
Sharon F 37 <add comment button>
After submitting the <update/delete button> you can change or delete the entered text.
I hope this example clears things up.
Regards,
Ram -
Prompting user for input for each row in the report
Is it possible to have a user entered field for each row in a report ?
ie. have a report with empolyee number, employee name, title, salary, and comment. Select of of these columns from the SQL query except for the comment, and then when the report is generated have the user be prompted for what the want the comment to be for every employee in the report?That is, have the user generating the report enter in a different comment for EACH employee. (ie Joe Smith's comment is "good worker and John Smith's comment is "come to work late on Tuesdays and Thursdays", Sally Jones' comment is "Expert in C++" etc.) as the reports is being built for each row returned from the query.
-
I am going to try asking this same question a different way as I have yet to find a working solution to my problem. I have a main report and then 8 sub reports. My main report has one data set and returns one row of data per account number. One
of the fields in the main data set is called AccountProf. My main report displays one page per Account number and then calls a different sub report based on that account's AccountProf value. The sub reports take in the account number as a parameter
and get multiple rows of data to display that accounts usage formatted differntly for each AccountProf (hence the 8 different sub report.
So far I can figure out how to do everything but setting the visibility property of each sub-reports when I have multiple accounts. If I use the following expression for the visibility property on each sub report, it makes all the applicable sub report
for all the accounts requested visible at once:
=IIF(Fields!AccountProf.Value= "USE_PLUS_DMD",False,True)
*The value in bold USE_PLUS_DMD is different for each sub report.
Here is a look at what the main report look like:
Here is the main reports data set:Hi JasonDWilson77,
According to your description, there is a main report and 8 sub reports in the report, you want to set visibility of sub reports, if no value is passed to the parameter of sub report, the sub report will not be displayed. If that is the case, please refer
to the following steps:
1. Create a new parameter named NewAccountNumber, set its data type the same as @AccountNumber, select Allow multiple values, set Visibility to be hidden, then set all available values to default values.
2. Right-click the first sub report and open Subreport Properties dialog box, click Parameters in left pane, set name to AccountNumber, then click (fx) button, type the expression like below:
=Parameters! NewAccountNumber(0)
3. Click Visibility in left pane, select Show or hide based on an expression, then click (fx) button and type the expression like below:
=IIF(InStr(Join(Parameters! AccountNumber.Value), Parameters!NewAccountNumber.Value(0))>0 , false,true)
4. Modify parameter of other sub reports like step2.
5. Set visibility of other sub reports like step3.
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
If you have any feedback on our support, please click
here.
Wendy Fu
TechNet Community Support -
Different values in a list box for each row of the table control...
Dear Experts,
Is it possible to populate different values for each row in a listbox inside a table control ?
Example,
Row 1 in the the table contains A, B & C
Row 2 in the same table contains C, D & E
If yes, How?
yes i am using
call function 'VRM_SET_VALUES'
exporting
id = i_name
values = i_list.
Thank you .
Message was edited by:
Kokwei Wong
Message was edited by:
Kokwei WongHi Wong,
this is code example for listbox
TYPE-POOLS vrm .
DATA: lt_vrm_values TYPE TABLE OF vrm_value.
DATA: wa_vrm_values TYPE vrm_value.
PARAMETER p_list AS LISTBOX VISIBLE LENGTH 10.
INITIALIZATION.
wa_vrm_values-key = 'Key1'.
wa_vrm_values-text = 'Value1'.
APPEND wa_vrm_values TO lt_vrm_values.
wa_vrm_values-key = 'Key2'.
wa_vrm_values-text = 'Value2'.
APPEND wa_vrm_values TO lt_vrm_values.
wa_vrm_values-key = 'Key3'.
wa_vrm_values-text = 'Value3'.
APPEND wa_vrm_values TO lt_vrm_values.
AT SELECTION-SCREEN OUTPUT.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_LIST'
values = lt_vrm_values
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
To fill it with data from DB, just do select in INITIALIZATION and put that values with same alghoritmus.
Manas M.
P.S.: This is very easy question, you should use search ... -
Tax break up in line by line for each item in the repetitive area
Dear SAP PLD Experts
I am facing a problem for generating excise invoice in pld with tax break for each line item .
for eg : i have 5 line item in the invoice.
so , i want to show the tax break up for each line item seperately in column wise .
slNo----Item CodeQtyPriceCenvat E.Cess---- H.E.Cess-- Vat--
Total
1-- A 5 -1000 96.401.920.96 40.00--- line total
2
3
4
5
But when i am showing the Tax amount from Sales tax authorities table in repetitive area, its showing 25 line numers instead of 5 line. and tax amounts is showing line by line.
Can any body help me to sort out this issue.
Thanks
RegardsDear,
Add the UDF's on the marketing document you want the tax break up.
Apply FMS using below queries and call these UDF's on your PLD.
FOR BED
DECLARE @Amount as Numeric(19,2)
DECLARE @Rate as Numeric(19,0)
DECLARE @TAmount as Numeric(19,2)
set @TAmount =$[$38.21.Number]
SELECT @Rate=STA1.Rate
FROM OSTC INNER JOIN
STC1 ON OSTC.Code = STC1.STCCode INNER JOIN
STA1 ON STC1.STACode = STA1.StaCode Where OSTC.Code=$[$38.160.0] And STA1.SttType='9' order by STA1.EfctDate desc
set @Amount=(@TAmount * @Rate)/100
Select @Amount
For Cess
DECLARE @Amount as Numeric(19,2)
DECLARE @Rate as Numeric(19,0)
DECLARE @TAmount as Numeric(19,2)
set @TAmount = $[$38.U_BED.Number]
SELECT @Rate=STA1.Rate
FROM OSTC INNER JOIN
STC1 ON OSTC.Code = STC1.STCCode INNER JOIN
STA1 ON STC1.STACode = STA1.StaCode Where OSTC.Code=$[$38.160.0] And STA1.SttType='8' order by STA1.EfctDate desc
set @Amount=(@TAmount * @Rate)/100
Select @Amount
For HCess
DECLARE @Amount as Numeric(19,2)
DECLARE @Rate as Numeric(19,0)
DECLARE @TAmount as Numeric(19,2)
set @TAmount = $[$38.U_BED.Number]
SELECT @Rate=STA1.Rate
FROM OSTC INNER JOIN
STC1 ON OSTC.Code = STC1.STCCode INNER JOIN
STA1 ON STC1.STACode = STA1.StaCode Where OSTC.Code=$[$38.160.0] And STA1.SttType='10' order by STA1.EfctDate desc
set @Amount=(@TAmount * @Rate)/100
Select @Amount
This will help you.
regards,
Neetu -
Condtion based xml for each row of the table t-sql
Hello ,
i have below data.
create table #students
id int identity(1,1) primary key,
student_id int not null,
[s_m_cml] xml
insert into #students
student_id,
[s_m_xml]
values
101,
'<submarks><submark><subject>Arts</subject><marks>85</marks></submark><submark><subject>Science</subject><marks>95</marks></submark><submark><subject>maths</subject><marks>100</marks></submark></submarks>'
),(102,'<submarks><submark><subject>Arts</subject><marks>50</marks></submark><submark><subject>Science</subject><marks>75</marks></submark><submark><subject>maths</subject><marks>85</marks></submark></submarks>')
select * from #students
if all subjects- marks in s_m_xml marks > 80 then i select the row as promoted else as demoted. the exact output should look like below.
student_id [status]
101 promoted
102 demoted
what is the best way to achieve this using t-sql. Thanks in advance for any suggestions.You dont need to parse out the values from xml for this
You can do the check inline
see illustration below
drop table #students
create table #students
id int identity(1,1) primary key,
student_id int not null,
[s_m_cml] xml
insert into #students
student_id,
[s_m_cml]
values
101,
'<submarks><submark><subject>Arts</subject><marks>85</marks></submark><submark><subject>Science</subject><marks>95</marks></submark><submark><subject>maths</subject><marks>100</marks></submark></submarks>'
),(102,'<submarks><submark><subject>Arts</subject><marks>50</marks></submark><submark><subject>Science</subject><marks>75</marks></submark><submark><subject>maths</subject><marks>85</marks></submark></submarks>')
,(104,'<submarks><submark><subject>Arts</subject><marks>92</marks></submark><submark><subject>Science</subject><marks>88</marks></submark><submark><subject>maths</subject><marks>98</marks></submark></submarks>')
select *,
case when [s_m_cml].exist('/submarks/submark[data(marks) < 80]')=1 then 'demoted' else 'promoted' end as status
from #students
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Raise expection for each row if returned set contains x
Hello Guys,
I have the following code and almost gave up on the idea to raise an exception and print
a line for each row where the sales price is < 10. I know how this works with a CURSOR but I want to try it without it. Thinking about it let me to the conclusion that this is not possible to act on individual row results on a set based operation. I will have to use a CURSOR (not set based so I can look at each row).
Am I thinking correctly?
(Code example deleted due to confusion)
Code example deleted due to confusion
Edited by: metalray on 10.11.2010 01:07Hi 3360,
I am using PL/SQL. I can make my point without any code.
The question, in a different format is this:
Can I throw an whatever exception (or dbms_output put line) for individual rows WITHOUT using a cursor.
My answer (and I just need clarification on this):
*(1)* No, because anything apart from a cursor is set-based and set-based operations (select, join, union)
can not through exceptions on individual rows.
*(2)* Yes, you can have a DBMS_OUTPUT.PUT_LINE with whatever exception on a set based operation
for each individual row that causes the exception (I dont think this answer is true :)
@Agustin UN, thanks for that. I know that is possible :) The problem is,
that I dont think I can print or fetch each individual row that causes the "exception" since
it is treated as a set. - I am welcome for someone to tell me that it work nevertheless -
I want to insert the line under each row except last one
Hi,
How to test it is the last row in the Rich:datalist component?
I want to add the line under each row except the last one.<x:someUIDataTag binding="#{someBean.someUIDataProperty}" value="#{someBean.someList}">
<x:someUIColumnTag>
<x:someUIOutputTag rendered="#{someBean.someUIDataProperty.rowIndex + 1 != someBean.someListSize}" />
</x:someUIColumnTag>
</x:someUIDataTag> -
This is regarding printing vertical lines for each and every field
Hi to all.....
1....Hi
here is a requirement
i want to print vertical lines and horizontal lines for each and every field in the output of a report.Here i want to see the output just like table i.e i want to draw line after each field.
suppose if the output list contains just 10 records, then the vertical line must end for 10 records.how to draw vertical lines for this requirement.
thanks and regards,
k.swaminathHi
In report you can use
sy-uline for horizontal line
sy-vline for vertical lines.
Check this sample report
DATA: BEGIN OF USR_TABL OCCURS 0.
INCLUDE STRUCTURE UINFO.
DATA: END OF USR_TABL.
DATA: L_LENGTH TYPE I,
T_ABAPLIST LIKE ABAPLIST OCCURS 0 WITH HEADER LINE, BEGIN OF T_USER OCCURS 0, COUNTER TYPE I, SELECTION TYPE C, MANDT LIKE SY-MANDT, BNAME LIKE SY-UNAME, NAME_FIRST LIKE V_ADRP_CP-NAME_FIRST, NAME_LAST LIKE V_ADRP_CP-NAME_LAST, DEPARTMENT LIKE V_ADRP_CP-DEPARTMENT, TEL_NUMBER LIKE V_ADRP_CP-TEL_NUMBER, END OF T_USER, L_CLIENT LIKE SY-MANDT, L_USERID LIKE UINFO-BNAME, L_OPCODE TYPE X, L_FUNCT_CODE(1) TYPE C, L_TEST(200) TYPE C.
L_OPCODE = 2.
CALL ThUsrInfo ID OPCODE FIELD L_OPCODE
ID TAB FIELD USR_TABL-*SYS*.
CLEAR T_USER. REFRESH T_USER.
LOOP AT USR_TABL.
T_USER-MANDT = USR_TABL-MANDT. T_USER-BNAME = USR_TABL-BNAME. APPEND T_USER.
ENDLOOP.
SORT T_USER.
DELETE ADJACENT DUPLICATES FROM T_USER.
LOOP AT T_USER.
T_USER-COUNTER = SY-TABIX. SELECT V~NAME_FIRST V~NAME_LAST V~DEPARTMENT V~TEL_NUMBER INTO (T_USER-NAME_FIRST, T_USER-NAME_LAST, T_USER-DEPARTMENT, T_USER-TEL_NUMBER) FROM USR21 AS U JOIN V_ADRP_CP AS V ON U~PERSNUMBER = V~PERSNUMBER AND U~ADDRNUMBER = V~ADDRNUMBER WHERE U~BNAME = T_USER-BNAME. ENDSELECT. MODIFY T_USER.
ENDLOOP.
SORT T_USER BY NAME_LAST NAME_FIRST.
PERFORM DISPLAY_LIST.
TOP-OF-PAGE.
PERFORM DISPLAY_MENU.
* End of top-of-page
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM DISPLAY_MENU.
* End of top-of-page during line-selection
AT LINE-SELECTION.
IF SY-CUROW = 2. IF SY-CUCOL < 19. T_USER-SELECTION = X. MODIFY T_USER TRANSPORTING SELECTION WHERE SELECTION = . PERFORM DISPLAY_LIST. ELSEIF SY-CUCOL < 36. CLEAR T_USER-SELECTION. MODIFY T_USER TRANSPORTING SELECTION WHERE SELECTION = X. PERFORM DISPLAY_LIST. ELSEIF SY-CUCOL < 50. PERFORM TRANSFER_SELECTION. PERFORM POPUP_MSG. ELSEIF SY-CUCOL < 67. PERFORM TRANSFER_SELECTION. SORT T_USER BY NAME_LAST. PERFORM DISPLAY_LIST. ELSEIF SY-CUCOL < 81. PERFORM TRANSFER_SELECTION. SORT T_USER BY NAME_FIRST. PERFORM DISPLAY_LIST. ELSEIF SY-CUCOL < 93. PERFORM TRANSFER_SELECTION. SORT T_USER BY MANDT. PERFORM DISPLAY_LIST. ENDIF. ENDIF.
* End of line-selection
*& Form DISPLAY_LIST
FORM DISPLAY_LIST.
SY-LSIND = 0.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
LOOP AT T_USER.
WRITE: / SY-VLINE, T_USER-SELECTION AS CHECKBOX, SY-VLINE, T_USER-MANDT, SY-VLINE, T_USER-BNAME, SY-VLINE, T_USER-NAME_FIRST(15), SY-VLINE, T_USER-NAME_LAST(15), SY-VLINE, T_USER-DEPARTMENT, SY-VLINE, T_USER-TEL_NUMBER(20), SY-VLINE. HIDE: T_USER-COUNTER, T_USER-SELECTION.
ENDLOOP.
FORMAT COLOR OFF.
WRITE: /(108) SY-ULINE.
ENDFORM. DISPLAY_LIST
*& Form DISPLAY_MENU
FORM DISPLAY_MENU.
FORMAT COLOR COL_HEADING HOTSPOT. WRITE: (91) SY-ULINE, / SY-VLINE NO-GAP, (4) ICON_SELECT_ALL NO-GAP, Select All, SY-VLINE NO-GAP, (4) ICON_DESELECT_ALL NO-GAP, Deselect All, SY-VLINE NO-GAP, (4) ICON_SHORT_MESSAGE NO-GAP, Send Popup, SY-VLINE NO-GAP, (4) ICON_SORT_UP NO-GAP, Last Name NO-GAP, SY-VLINE NO-GAP, (4) ICON_SORT_UP NO-GAP, First Name NO-GAP, SY-VLINE NO-GAP, (4) ICON_SORT_UP NO-GAP, Client NO-GAP, SY-VLINE, /(91) SY-ULINE, /(108) SY-ULINE. FORMAT HOTSPOT OFF. WRITE: / SY-VLINE, , SY-VLINE, Cli, SY-VLINE, User , SY-VLINE, First Name , SY-VLINE, Last Name , SY-VLINE, Department , SY-VLINE, Telephone , SY-VLINE, /(108) SY-ULINE. FORMAT COLOR OFF.
ENDFORM. DISPLAY_MENU
*& Form TRANSFER_SELECTION
FORM TRANSFER_SELECTION.
DO. READ LINE SY-INDEX FIELD VALUE T_USER-SELECTION. IF SY-SUBRC <> 0. EXIT. ENDIF. MODIFY T_USER TRANSPORTING SELECTION WHERE COUNTER = T_USER-COUNTER. ENDDO. CLEAR T_USER.
ENDFORM. TRANSFER_SELECTION
*& Form POPUP_MSG
FORM POPUP_MSG.
DATA: L_MSG LIKE SM04DIC-POPUPMSG VALUE Experimental Message, L_LEN TYPE I, L_RET TYPE C. LOOP AT T_USER WHERE SELECTION = X. PERFORM GET_MESSAGE CHANGING L_MSG L_RET. EXIT. ENDLOOP. IF L_RET = A. User cancelled the message EXIT. ENDIF.
* Get the message text
L_LEN = STRLEN. LOOP AT T_USER WHERE SELECTION = X. CALL FUNCTION TH_POPUP EXPORTING CLIENT = T_USER-MANDT USER = T_USER-BNAME MESSAGE = L_MSG MESSAGE_LEN = L_LENGTH
* CUT_BLANKS =
EXCEPTIONS USER_NOT_FOUND = 1 OTHERS = 2. IF SY-SUBRC <> 0. WRITE: User , T_USER-BNAME, not found.. ENDIF. ENDLOOP. IF SY-SUBRC <> 0.
* Big error! No user has been selected.
MESSAGE ID AT TYPE E NUMBER 315 WITH No user selected!. EXIT. ENDIF.
ENDFORM. POPUP_MSG
*& Form GET_MESSAGE
FORM GET_MESSAGE CHANGING P_L_MSG LIKE SM04DIC-POPUPMSG
P_RETURNCODE TYPE C.
DATA: BEGIN OF FIELDS OCCURS 1. INCLUDE STRUCTURE SVAL.
DATA: END OF FIELDS, RETURNCODE TYPE C.
FIELDS-TABNAME = SM04DIC.
FIELDS-FIELDNAME = POPUPMSG.
FIELDS-FIELDTEXT = Message :. CONCATENATE Msg from SY-UNAME . INTO FIELDS-VALUE SEPARATED BY . APPEND FIELDS.
CALL FUNCTION POPUP_GET_VALUES
EXPORTING POPUP_TITLE = Supply the popup message
IMPORTING RETURNCODE = P_RETURNCODE
TABLES FIELDS = FIELDS.
IF P_RETURNCODE = A.
EXIT.
ELSE.
READ TABLE FIELDS INDEX 1.
P_L_MSG = FIELDS-VALUE.
ENDIF.
ENDFORM. GET_MESSAGE
*End of Program
Regards
Pavan -
How to process a block for each row in an internal table....
Hi experts....
In po approval workflow the scenario is like this.... for each po there may be more than one approver. approvers list i am maintaining in the ztable. list of approvers(no of approvers) is decided by the po value. I have collected these approvers into internal table. now i have to process a block ( approving or rejecting the po... )in the workflow for each row in the internal table.
how can i do this. based on the decision of the 1st approver approves the po then it should go to next approver in the internal table...otherwise end the workflow.....
Please help me......i have created an internal table in the workflow container in which i am getting the list of approvers....
how can i loop the internal table in the workflow...?
how can i know the index of the loop in the workflow.....(will sy-index work here....? so that i can use loop until step in the main workflow to call the subworkflow..so that if sy-index is greater than no of entires in the itab then i can come out of the loop) -
Suddenly my iCal has begun showing two lines for each birthday in my address book
Suddenly my iCal monthly view has begun listing two lines for each birthday from the address book. I didn't make any changes to the preferences. How do I return to one listing per birthday?
I've noticed this as well. I think it started with 10.7.4.
-
Update primary key with a tabular form based on a select list for each row
Hello!
I've two tables: Table1 with only one column (primary key) is a foreign key for table2.column1 (primary key). There is also a second primary key column in table2.
Now I want to change the primary key values in table2.column1 with a tabular form (MRU) based on a select list (LOV based on table1.column1) for each row.
The user should be able to choose for every row a new value from the select list to change the old primary key value at this position.
How can I do this with ApEx?
I've the tabular form and so on, but at the moment I get the following error:
"Error in mru internal routine: ORA-20001: Fehler in MRU: row= 1, ORA-20001: ORA-20001: Die aktuelle Version der Daten in der Datenbank wurde geändert, seit der Benutzer einen Update-Prozess eingeleitet hat. ..."
Thank you for your support!
KayHello!
I've two tables: Table1 with only one column (primary key) is a foreign key for table2.column1 (primary key). There is also a second primary key column in table2.
Now I want to change the primary key values in table2.column1 with a tabular form (MRU) based on a select list (LOV based on table1.column1) for each row.
The user should be able to choose for every row a new value from the select list to change the old primary key value at this position.
How can I do this with ApEx?
I've the tabular form and so on, but at the moment I get the following error:
"Error in mru internal routine: ORA-20001: Fehler in MRU: row= 1, ORA-20001: ORA-20001: Die aktuelle Version der Daten in der Datenbank wurde geändert, seit der Benutzer einen Update-Prozess eingeleitet hat. ..."
Thank you for your support!
Kay -
Use labview to read an Excel file to some control and add a checkbox for each row
As the subject say,I need to use labview to read an excel file,and show it in some control,such as mclb;then ,I should add an checkbox for each row,enable me to choose the row i want.What should I do ? Many Thanks.
Solved!
Go to Solution.Hi,
to answer your question:
- read an excel file
- show it in some control, such as a MCLB
- add an checkbox for each row
- choose the row you want
Hint to make it easier: I wouldn't use checkboxes, as the MCLB already allows to select rows by mouseclick…
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
Hi there,
I am a beginner in Visual Basic Express 2010. I have a Point of Sale program that uses DataGridView to display records from an external microsoft access
database using the fillby query.
It works, but it repopulates the same row each time, but i want to be able to display multiple records at the same time, a new row should be filled for
each click of the fillby button.
also I want to be able to delete any records if the customer suddenly decides to not buy an item after it has already been entered.
so actually 2 questions here:
1. how to populate a new row for each click of the fillby button
2. how to delete records from data grid view after an item has been entered
Thanks
VishwasHello,
The FillBy method loads data according to what the results are from the SELECT statement, so if there is one row then you get one row in the DataGridView, have two rows then two rows show up.
Some examples
Form load populates our dataset with all data as it was defined with a plain SELECT statement. Button1 loads via a query I created after the fact to filter on a column, the next button adds a new row to the existing data. When adding a new row it is appended
to the current data displayed and the primary key is a negative value but the new key is shown after pressing the save button on the BindingNavigator or there are other ways to get the new key by manually adding the row to the backend table bypassing the Adapter.
The following article with code shows this but does not address adapters.
Conceptually speaking the code in the second code block shows how to get the new key
Public Class Form1
Private Sub StudentsBindingNavigatorSaveItem_Click(
sender As Object, e As EventArgs) Handles StudentsBindingNavigatorSaveItem.Click
Me.Validate()
Me.StudentsBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.MyDataSet)
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'MyDataSet.Students' table. You can move, or remove it, as needed.
Me.StudentsTableAdapter.Fill(Me.MyDataSet.Students)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.StudentsTableAdapter.FillBy(Me.MyDataSet.Students, ComboBox1.Text)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.MyDataSet.Students.AddStudentsRow("Jane", "Adams", "Female")
End Sub
End Class
Get new key taken from
this article.
Public Function AddNewRow(ByVal sender As Customer, ByRef Identfier As Integer) As Boolean
Dim Success As Boolean = True
Try
Using cn As New OleDb.OleDbConnection With {.ConnectionString = Builder.ConnectionString}
Using cmd As New OleDb.OleDbCommand With {.Connection = cn}
cmd.CommandText = InsertStatement
cmd.Parameters.AddWithValue("@CompanyName", sender.CompanyName)
cmd.Parameters.AddWithValue("@ContactName", sender.ContactName)
cmd.Parameters.AddWithValue("@ContactTitle", sender.ContactTitle)
cn.Open()
cmd.ExecuteNonQuery()
cmd.CommandText = "Select @@Identity"
Identfier = CInt(cmd.ExecuteScalar)
End Using
End Using
Catch ex As Exception
Success = False
End Try
Return Success
End Function
In closing I have not given you a solution but hopefully given you some stuff/logic to assist with this issue, if not perhaps I missed what you want conceptually speaking.
Additional resources
http://msdn.microsoft.com/en-us/library/fxsa23t6.aspx
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.
Maybe you are looking for
-
FF5: Some sites will not load, but no error messages
I'm using Firefox 5 on Windows Vista Home SP1. Since I upgraded to FF5, some sites either simply will not load. No error messages are given - the green circle icon in the tab just keep spinning. There's two pages that I visit daily that this happens
-
Looping through HUGE directory - How to do so most efficiently?
Hello, I have a HUGE directory (200k files or so) - currently I'm using the below method to read the file names and place the results into a map. However, this is on a windows box and to run the class that uses this, I have to increase the memory usa
-
How to put images on graph?
Hello, I want to put images on graph whereever I want. I have TDMS file like this. My "x Axis" is (km) and "y axis" is MKTY. If MKTY is 3 I want to put image3 on graph places in the y-axis. If MKTY is 2 then I put "image2" on graph. I uploaded my TD
-
Database Restore in SQL Server
Hello, I have a Server in SQL Server 2012 which have two Databases called DB1 and DB2 . I have taken full backup of DB1 and want to restore in DB2 without Modifying its name,logical name and physical name. how can i do it ? Prem Shah
-
WRT320N Can't get IP Address - only using 1 wired port - no internet access - web setup pages hang
Just bought Linksys WRT320N to replace Netgear MR814. Can't get connected to internet using Linksys WRT320N. Setup: ISP: Cox Communications (Cable) Firmware: v1.0.03 build 010 Jul 24, 2009 1 wired - port 1- to Windows XP SP 3 Dell Desktop Setup At