Changing column value on every row in invoice matrix
Hi,
I'm trying to change the value of the GLaccount column for every row in the invoice matrix when the user changes the document owner. The code seems to work for the first row but then on other rows I get a message that says the item can't be changed because it can't get focus. I know there are similar posts on the forum already, but nothing that solves this problem that I can see.
My code follows:
<B1Listener(BoEventTypes.et_CHOOSE_FROM_LIST, False)> _
Public Overridable Sub OnAfterChooseFromList(ByVal pVal As ItemEvent)
Dim ActionSuccess As Boolean = pVal.ActionSuccess
Dim form As Form = B1Connections.theAppl.Forms.Item(pVal.FormUID)
Dim item As Item = form.Items.Item("222") 'document owner
Dim item2 As Item = form.Items.Item("38")
Dim Matrix As Matrix = CType(item2.Specific, Matrix)
Dim userID As String
userID = ChooseFromList_Value(pVal)
If ActionSuccess And pVal.InnerEvent Then
ChangeMatrixAccounts(Matrix, userID)
End If
End Sub
Friend Function ChangeMatrixAccounts(ByVal zMatrix As SAPbouiCOM.Matrix, ByVal zDocOwner As String) As ReturnStatus
For x = 1 To zMatrix.RowCount
Dim cell As SAPbouiCOM.Cell = zMatrix.Columns.Item("159").Cells.Item(x)
Dim oedit As SAPbouiCOM.EditText = zMatrix.Columns.Item("159").Cells.Item(x).Specific
cell.Click(SAPbouiCOM.BoCellClickType.ct_Regular) 'force focus, I hope
ChangeRevenueAccountInCell(oedit, WhseGLLocCode)
Next
end function
Private Function ChangeRevenueAccountInCell(ByVal zGLAcct As SAPbouiCOM.EditText, ByVal zWhseGLLocCode As String) As ReturnStatus
Dim tempwork(2) As String
'change the value of the matrix cell passed in to the new gl acct
tempwork = zGLAcct.Value.Split("-")
<b>zGLAcct.Value = tempwork(0) & "-" & tempwork(1) & "-" & zWhseGLLocCode</b>
Console.Write(" Changed GL value")
End Function
Is there more to it than that? -- THANKS!
Hi John,
I don't know if this is of use, but here's the code I used to set the project code value on each row of a marketing document through the UI (which is similar to what you are looking to do). The Project Code column needs to be visible and editable for this to work:
Private Function SetProjectCodeOnRows(ByVal oForm As SAPbouiCOM.Form, ByVal oMatrix As SAPbouiCOM.Matrix, ByVal sProjectCode As String) As Boolean
Dim bSuccess As Boolean = True
Dim sItemCode As String
Dim sExistingProjCode
Dim i As Int32
Dim oCol As SAPbouiCOM.Column
Dim oEdit As SAPbouiCOM.EditText
Dim oFolder As SAPbouiCOM.Folder
'Select the Contents folder before updating any project codes
oFolder = oForm.Items.Item("112").Specific
oFolder.Select()
For i = 1 To oMatrix.RowCount
Try
' Check to see if an item code has been entered (last line will always be empty)
oCol = oMatrix.Columns.Item("1")
oEdit = oCol.Cells.Item(i).Specific
sItemCode = oEdit.String
' Read the project code from the row
oCol = oMatrix.Columns.Item("31")
oEdit = oCol.Cells.Item(i).Specific
sExistingProjCode = oEdit.String
If sExistingProjCode = "" And sItemCode <> "" Then
oEdit.Value = sProjectCode
End If
Catch ex As Exception
m_sboApp.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Medium, True)
bSuccess = False
End Try
Next i
SetProjectCodeOnRows = bSuccess
End Function
Kind Regards,
Owen
Similar Messages
-
How To Concatenate Column Values from Multiple Rows into a Single Column?
How do I create a SQL query that will concatenate column values from multiple rows into a single column?
Last First Code
Lesand Danny 1
Lesand Danny 2
Lesand Danny 3
Benedi Eric 7
Benedi Eric 14
Result should look like:
Last First Codes
Lesand Danny 1,2,3
Benedi Eric 7,14
Thanks,
David JohnsonStarting with Oracle 9i
select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
from
(select last, first, code, row_number() over(partition by last, first order by code) rn
from a)
connect by last = prior last and first = prior first and prior rn = rn -1
start with rn = 1
group by last, first
LAST FIRST CODES
Lesand Danny 1,2,3
Benedi Eric 7,14Regards
Dmytro -
Is it possible to Lock just one column value in a row?
Is it possible to Lock just one column value in a row
A Java Developer has just asked me if it is possible to Lock just one column value in a row in Oracle
select ename from emp where empno=7369 for update;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
will lock the entire row with empno=7369.
But is it possible to lock one column value from this row, like SAL=800 ?
Edited by: J.Kiechle on Jan 8, 2009 10:45 PMJ.Kiechle wrote:
Is it possible to Lock just one column value in a rowNo. Locking granularity is a row. -
Concatenate a column value across multiple rows - PDW
We are using PDW based on SQL2014. We require an efficient logic on how to concatenate a column value across multiple rows. We have the following table
T1
(CompanyID, StateCD)
Having following rows:
1 NY
1 NJ
1 CT
2 MA
2 NJ
2 VA
3 FL
3 CA
We need a code snippet which will return following result set:
1
CT,NJ,NY
2
MA,NJ,VA
3
CA,FL
We have tried built-in function STUFF with FOR XML PATH clause and it is not supported in PDW. So, we need a fast alternative.Hi Try this:
SELECT * INTO #ABC
FROM
SELECT 1 AS ID,'NY' AS NAME
UNION
SELECT 1 AS ID,'NJ' AS NAME
UNION
SELECT 1 AS ID,'CT' AS NAME
UNION
SELECT 2 AS ID,'MA' AS NAME
UNION
SELECT 2 AS ID,'NJ' AS NAME
UNION
SELECT 2 AS ID,'VA' AS NAME
UNION
SELECT 3 AS ID,'FL' AS NAME
UNION
SELECT 3 AS ID,'CA' AS NAME
)A
CREATE TABLE ##CDB (ID INT, NAME NVARCHAR(800))
DECLARE @TMP VARCHAR(MAX),
@V_MIN INT,
@V_MAX INT,
@V_COUNT INT
SELECT @V_MIN=MIN(ID),@V_MAX=MAX(ID) FROM #ABC
SET @V_COUNT=@V_MIN
WHILE @V_COUNT<=@V_MAX
BEGIN
SET @TMP = '' SELECT @TMP = @TMP + CONVERT(VARCHAR,NAME) + ', ' FROM #ABC
WHERE ID=@V_COUNT
INSERT INTO ##CDB (ID, NAME) SELECT @V_COUNT AS ID ,CAST(SUBSTRING(@TMP, 0, LEN(@TMP)) AS VARCHAR(8000)) AS NAME
SET @V_COUNT=@V_COUNT+1
END
SELECT * FROM ##CDB
OR
SELECT * INTO #ABC
FROM
SELECT 1 AS ID,'NY' AS NAME
UNION
SELECT 1 AS ID,'NJ' AS NAME
UNION
SELECT 1 AS ID,'CT' AS NAME
UNION
SELECT 2 AS ID,'MA' AS NAME
UNION
SELECT 2 AS ID,'NJ' AS NAME
UNION
SELECT 2 AS ID,'VA' AS NAME
UNION
SELECT 3 AS ID,'FL' AS NAME
UNION
SELECT 3 AS ID,'CA' AS NAME
UNION
SELECT 5 AS ID,'LG' AS NAME
UNION
SELECT 5 AS ID,'AP' AS NAME
)A
CREATE TABLE ##CDB (ID INT, NAME NVARCHAR(800))
DECLARE @TMP VARCHAR(MAX),
@V_MIN INT,
@V_MAX INT,
@V_COUNT INT
SELECT @V_MIN=MIN(ID),@V_MAX=MAX(ID) FROM #ABC
SET @V_COUNT=@V_MIN
WHILE @V_COUNT<=@V_MAX
BEGIN
SET @TMP = '' SELECT @TMP = @TMP + CONVERT(VARCHAR,NAME) + ', ' FROM #ABC
WHERE ID=@V_COUNT
SELECT @V_COUNT AS ID ,CAST(SUBSTRING(@TMP, 0, LEN(@TMP)) AS VARCHAR(8000)) AS NAME INTO #TEMP
INSERT INTO ##CDB (ID, NAME) SELECT ID, NAME FROM #TEMP WHERE NAME<>''
DROP TABLE #TEMP
SET @V_COUNT=@V_COUNT+1
END
SELECT * FROM ##CDB
Thanks Shiven:) If Answer is Helpful, Please Vote -
Reg : Concatenation of a column value with multiple rows... URGENT
Hello,
Could any of u help me in concatenating a column value with
multiple rows ???
For ex : I've the following data from emp table :
DEPTNO ENAME
10 KING'S
30 BLAKE
10 CLARK
10 TOM JONES
30 ALLEN
30 JAMES
20 SMITH
20 SCOTT
20 MILLER
10 MILLER
20 rajeev
I want the following output :
deptno Concat_value
10 KING'S,CLARK,TOM JONES,MILLER
20 Rajeev,MILLER,SMITH,SCOTT
30 BLAKE,ALLEN,JAMES
Thanks in Advance,
SriniHello Naveen,
Thanks for ur answer. But I need a single SQL query for getting
what I want. I know the solution in PL/SQL.
Please try it in a single SQL....
Thanks again,
Srini -
How to catch changed column values in alv oops using grid
My requirement needs to catch changed column values in alv oops using grid .any method to do this.
please help me out ,
Tks in advanceHave a look into the SAP standarad Programs those programs have the edit option on the ALV output.
BCALV_EDIT_01
BCALV_EDIT_02
BCALV_EDIT_10.
Regards,
Gopi ,
Reward points if helpfull. -
How to change the column value upto 68000 rows
Hi,
I want to change the column value.
I have table called RefDoc
Select distinct r.int_ref from refdoc r where r.int_ref like '\\dxb%'
Int_Re__f
\\dxb\Sample\BFE B777\2008\PO2025225.tif
\\dxb\Sample\RO\SFR\26-01-2009j\RO2022098.pdf
\\dxb\Sample\RO\SFR\26-01-2009j\RO2040831.pdf
\\dxb\Sample\BFE B777\2008\PO2025253.tif
\\dxb\Sample\RO\UM INV\26-01-2009\RO2018358.pdf
up to 68000 rows
I want to change to \\AUH instead of \\dxb.
I want the table like
Int_Re__f
\\AUH\Sample\BFE B777\2008\PO2025225.tif
\\AUH\Sample\RO\SFR\26-01-2009j\RO2022098.pdf
\\AUH\Sample\RO\SFR\26-01-2009j\RO2040831.pdf
\\AUH\Sample\BFE B777\2008\PO2025253.tif
\\AUH\Sample\RO\UM INV\26-01-2009\RO2018358.pdf
Thanks
Niharuser REPLACE function and change it
UPDATE refdoc
SET int_ref = REPLACE(int_ref, '\\dxb\', '\\AUH\')
WHERE int_ref like '\\dxb\%' -
Change Column Value based on Characteristic in Rows
I am not sure it is possible.
We have product prices at different levels of customer hierarchy.
Channel > Division > Region > Market
One Region can have multiple Markets. Each market can have different Rates. But the Region will have a different Rate which many not be the average rate of all market (assigned as part of master data)
I have a column for Product Price. So when a Report is run at Market Level it should use Market Rate. If Market is Removed and Region is dragged into the report it should use Region Rate for Product Price.
Product Price is Restricted by Rate Type value to determine which Rate is used.
Is there a way to dynamically determine the define the column value based on the characteristic value in the ROWS.
ThanksHi,
For every CHAR like Market/Region there will be some key. For example Maket1 = 11 and Market2 = 22. If that key is a number then you may create replacement path variable on that and convert the same in numbers then you may create various CKF (for various rate type) and put "If" condtion and check for those replacement path CKF and use the apprpriate one.
You need to write some tricky formula at CKF levels. This is one of the way to achieve that.
I hope it will help.
Thanks,
S -
Custom row-fetch and how to get column values from specific row of report
Hi -- I have a case where a table's primary key has more than 3 columns. My report on the
table has links that send the user to a single-row DML form, but of course the automatic
fetch won't work because 1) I can't set more than 3 item values in the link and 2) the
auto fetch only handles 2 PK columns.
1)
I have written a custom fetch (not sure it's the most elegant, see second question) that is working
for 3 or few PK columns (it references the 1-3 item values set in the link), but when there are
more than 3, I don't know how to get the remaining PK column values for the specific row that was
selected in the report. How can I access that row's report column values? I'll be doing it from the
form page, not the report page. (I think... unless you have another suggestion.)
2)
My custom fetch... I just worked something out on my own, having no idea how this is typically
done. For each dependent item (database column) in the form, I have a source of PL/SQL
function that queries the table for the column in question, using the primary key values. It works
beautifully, though is just a touch slow on my prototype table, which has 21 columns. Is there
a way to manually construct the fetch statement once for the whole form, and have APEX be smart
about what items get what
return values, so that I don't have to write PL/SQL for every item? Because my query data sources
are sometimes in remote databases, I have to write manual fetch and dml anyway. Just would like
to streamline the process.
Thanks,
CarolHI Andy -- Well, I'd love it if this worked, but I'm unsure how to implement it.
It seems I can't put this process in the results page (the page w/ the link, that has multiple report rows), because the link for the row will completely bypass any after-submit processes, won't it? I've tried this in other conditions; I thought the link went directly to the linked-to page.
And, from the test of your suggestion that I've tried, it's not working in the form that allows a single row edit. I tried putting this manually-created fetch into a before header process, and it seems to do nothing (even with a hard-coded PK value, just to test it out). In addition, I'm not sure how, from this page, the process could identify the correct PK values from the report page, unless it can know something about the row that was selected by clicking on the link. It could work if all the PK columns in my edit form could be set by the report link, but sometimes I have up to 5 pk columns.
Maybe part of the problem is something to do with the source type I have for each of the form items. With my first manual fetch process, they were all pl/sql functions. Not sure what would be appropriate if I can somehow do this with a single (page level?) process.
Maybe I'm making this too hard?
Thanks,
Carol -
Changing Column Value Style using SQL Query
Hi,
I'm trying to build a fantasy basketball game with APEX. I have a table that has a list of games. I need to change the color of the column value i.e. the name of the team that wins according to a SQL query Here's an example:
TABLE NAME: LATESTGAMES
Home Away Homepoints Awaypoints
Boston Cleveland 105 101
Toronto Washington 122 83
What I want to do is display the winning team i.e. Boston and Toronto in Green since that's the team that won.
The SQL query is:
SELECT HOME,
AWAY,
HOMEPOINTS,
AWAYPOINTS
from LATESTGAMES;
What do I need to do in order to display the Winning Team as Green on every column? Please HelpHello Devilfish,
I did something like that in my DG Tournament application (http://www.dgtournament.com)
Your SQL query can look like this:
SELECT CASE
WHEN (homepoints > awaypoints)
THEN '<span style="color:green;">' || home || '</span>'
ELSE home
END AS home,
SELECT CASE
WHEN (awaypoints > homepoints)
THEN '<span style="color:green;">' || away|| '</span>'
ELSE away
END AS away,
HOMEPOINTS,
AWAYPOINTS
from LATESTGAMES;Hope that gives you an idea,
Dimitri
-- http://dgielis.blogspot.com
-- http://apex-evangelists.com -
How to Update some column values in some rows in an advanced table
Hi Gurus,
Can any body help on this issue.
I am having a results table which is showing all the queried parties data queried in a seeded page in OCO module.
Lets assume the table contains 10 rows with the below columns
Party Name, Registry ID, Address Country, Match Percentage, Certification Level, Certification Reason, Internal Indicator, Status .
Certification Level, Certification Reason and Internal Indicator are the dropdowns.
The user want to update some of these fields values for some rows randomly.
After doing this if he click on Save button, Only thosed changed rows need to get update using a Custom Procedure.
But here all the rows irrespective of the change getting updated.
So how to capture the modified rows.
Appreciate any inputs..
Thanks
Palepu
Edited by: Palepu on 9 Aug, 2012 4:25 PMNot sure if you got the answer. You need to capture the row which got changed using the below and get the column value using the getAttribute method. This works for single selection row, if it is multi selection then you will have to loop through all selected rows and find the VO attribute value.
String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
Row currentRow = am.findRowByRef(rowReference);
String param1= (String)currentRow.getAttribute("VOAttribute");
Let me know if there are any issues.
Thanks
Shree -
How to convert colon separated column values in multiple rows in report
Hi All,
I want to display colon separated values from a column, in a multi row in report.
For example i have a column1 in a table with value 'A:B:C' , column2 has value '1'.
i want to show in a report three rows using these two columns like
column1 column2
A 1
B 1
C 1Here's one way:
SQL> create table test (col1 varchar2(20), col2 number);
Table created.
SQL> insert all
2 into test values ('A:B:C', 1)
3 into test values ('Dg:Ezs', 2)
4 select * from dual;
2 rows created.
SQL> select
2 t.col2,
3 regexp_substr(t.col1, '\w+', 1, t2.column_value) c1
4 from test t,
5 table(cast(multiset(select level
6 from dual
7 connect by level <= length(t.col1) - length(replace(t.col1, ':', '')) + 1
8 ) as sys.odcinumberlist )) t2
9 order by 2, 1;
COL2 C1
1 A
1 B
1 C
2 Dg
2 Ezs
SQL>Edited by: Littlefoot on Jan 31, 2012 10:13 AM -
SQL Developer - Pulling column value from previous row
I am using Oracle SQL developer and trying to pull a value from a column from the previous row.
Currently this is an example from the code im using.
Select CD1.nbr_dw, CD1.SEQ_DW, CD1.CDL_NET_PAID, CD1.UNITS_ALLOW,CD1.ALLOW_AMT, CD1.UNIT_PRICE, CD1.BACKED_OUT,
case
When CD1.NET_PAID = 0 then 0
****NEW CODE*****
Else CD1.ALLOW_AMT / CD1.UNIT_PRICE
end as NEW_UNITS
From Table_A CD1
join (Select nbr_dw, DET_DW, SEQ_DW
From Table_B
) CD2
on CD1.nbr_dw = CD2.nbr_dw
I need to add another when statement that says when CD1.BACKED_OUT = 'Y' populated the NEW_UNITS field with the previous rows value of CD1.UNIT_PRICE. Note, the CD1.SEQ_DW can be used to determine the previous row. Any ideas?Hi,
Welcome to the forum!
The analytic LAG function can return a value from the previous row:
LAG (cd1.unit_price) OVER ( -- PARTITION BY x -- if needed
ORDER BY cd1.seq_dw
)It's unclear if you need a PARTITION BY clause or not.
"PARTITION BY x" means that you want the value from the last row that has the same value of x as the current row.
If you omit the PARTITION BY clause, it means you want the last row regardless of what any other columns are.
Whenever you have a problem, it ehlps if you post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
Explain how you get those results from that data.
Always say what version of Oracle you're using. -
Read one column and output its second column value in same row
Hi
I have 2 columns, of which I only wish to read the first column. There is an input value, which comes from an outside source, but we can call a constant for this particular question. This constant value must be compared to these first column values, untill it equals the same value. The code must then read the second columns value in the same row and output this value. The exel spreadsheet is below as an example, though the sheet has far more values and larger numbers.
If there is no value in the first column which is equal to the input constant, it must output a 0. If anyone could help with this it would be fantastic. I'm still busy working on it and might get it eventually, but I would like to get there faster a great deal.
Thanks
Jingles
Attachments:
Exel.JPG 35 KBJingles,
if you get the data in a 2d array, you should be able to write soemthing like this pseudocode:
while i<max length
if checkvalue=array[1,i]
output array[2,i]
i++
if output is empty output zero
Regards,
Kyle Mozdzyn
Applications Engineering
National Instruments
Regards,
Kyle M.
Applications Engineering
National Instruments -
I have a SSRS report which uses a matrix for a crosstab effect.
Each row contains about 10 score values in 10 columns respectively. I need each row to check against the previous row, and i need each score value in each column to be compared to the corresponding column score value in the previous row.
If the current score is greater than the corresponding previous score (in the previous row), then i want to change the background of the cell.
if the current score is smaller than the previous, then it's a different color.
if they are equal, or it's the first row in the matrix table, then leave white.
I have found custom code functions to use in the SSRS expression fields, but every single one of them compares against the previous COLUMN value and not the previous ROW value which is what i need. the "Previous" function would be perfect if i
could use it in a matrix but i can't. (i keep getting error "The use of a Previous aggregate function in a tablix cell is not supported"). looking around it turns out that matrices are arrange in groups and not in rows which is why Previous can't
be used and the only way is with custom code.
Please help. if you have any custom code samples that achieve what i need, please share, or give me advice on how to achieve this.
Thank youI figured it out. Maybe it can help someone else in the future:
Public Shared count as Integer = 0
Public Shared currentRow As Integer = 1
Public Shared MatrixStructures As New System.Collections.Generic.List(Of MatrixStructure)()
Public Shared Function GetCellColor(row as Integer, score as Integer)
If (row > currentRow) Then
count = 0
currentRow = row
End If
count = count + 1
Dim matrixStructure As New MatrixStructure()
matrixStructure.RowIndex = row
matrixStructure.ColumnIndex = count
matrixStructure.ScoreValue = score
MatrixStructures.Add(matrixStructure)
If score = 0 Then
Return "White"
End If
Dim val As MatrixStructure = MatrixStructures.Find(Function(s As MatrixStructure)
Return s.GetRowIndex() = row - 1 AndAlso s.GetColumnIndex() = count
End Function)
If (Not (val Is Nothing)) Then
If val.scoreValue = 0 Then
Return "White"
End If
If score >= val.scoreValue + 2 Then
Return "Green"
ElseIf score <= val.scoreValue - 2 Then
Return "Red"
End If
End If
Return "White"
End Function
Public Class MatrixStructure
Public rowIndex As Integer
Property GetRowIndex() As Integer
Get
Return rowIndex
End Get
Set(ByVal Value As Integer)
rowIndex = Value
End Set
End Property
Public columnIndex As Integer
Property GetColumnIndex() As Integer
Get
Return columnIndex
End Get
Set(ByVal Value As Integer)
columnIndex = Value
End Set
End Property
Public scoreValue As Integer
Property GetScoreValue () As Integer
Get
Return scoreValue
End Get
Set(ByVal Value As Integer)
scoreValue = Value
End Set
End Property
End Class
and to pass the current row number from the expression i use this
Ceiling(RowNumber(NOTHING) / 10)
i divide the row number by 10 because there are ten columns. if you don't know the number of columns, or it's a variable number, then return it from the stored procedure query in the first place. that's what I had to do
Maybe you are looking for
-
How do I use apple remote with iPhone 5 ?
How do I use apple remote with iPhone 5 ?
-
Can you choose which datasource at runtime?
Is it possible to have a single report that can either pull data from one account or the other, based on, say, a user selection? For example, let's say I have one report for projects that shows us projects in our dev account in oracle, but may want t
-
Java applets videos not working on my MacBook Pro late 2011
Hello, I have Mac book pro wit os lion x 10.7.3 and the problem is that i am unable to play java videos from certain sites.. here is the screenshot please help me on this isue.
-
Can't see ishuffle on my mac during setup or download songs
I'm trying to set up my child's Christmas present, an ishuffle 2G. Following instruction manual. 3rd step - set up suffle using onscreen instructions when they appear. THEY DIDN'T. So I charged the battery and that's as far as I got. My computer is
-
Hi everybody. I´ve got a doubt about mapping templates. I have 4 mappings that are basiclly the same. Ive created a template and I use it in the 4 mappings. But I find this problems: There are fields that have differents mappings in the 4 mapping so