Sorting a number in first column of matrix
Hi All,
I tried following code for sorting number of first column of matrix. But when i click on AddRow menu it gives error and when i use commented line code that time it adds one row but number shows in column last row number.
And when i click on DeleteRow menu it delete only first time second time it is not working.
Can anybody tell me where i am wrong ? Plz suggest me exact code.
Public Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean)
Dim item As Matrix
formd = SBO_Application.Forms.ActiveForm
item = formd.Items.Item("2").Specific
Dim i As Integer
If pVal.MenuUID = "1292" Then
' item.AddRow(1, 1)
item.Columns.cells.item(item.RowCount).specific.value = item.RowCount
BubbleEvent = False
End If
If pVal.MenuUID = "1293" Then
For i = 1 To item.VisualRowCount
item.Columns.Item("V_-1").Cells.Item(i).Specific.value = i
Next
item.FlushToDataSource()
BubbleEvent = False
End If
End Sub
Hi...
Copy the code and change ur matrix id...
Private Sub SBO_Application_RightClickEvent(ByRef eventInfo As SAPbouiCOM.ContextMenuInfo, ByRef BubbleEvent As Boolean) Handles SBO_Application.RightClickEvent
If eventInfo.FormUID = "Ur Form ID" Then
If (eventInfo.BeforeAction = True) Then
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Dim omat As SAPbouiCOM.Matrix
Dim GCols As SAPbouiCOM.Columns
oitem = OForm.Items.Item("Ur Matrix")
omat = oitem.Specific
GCols = omat.Columns
Try
selItem = eventInfo.ItemUID
Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
oCreationPackage.UniqueID = "OnlyOnRC"
oCreationPackage.String = "Delete Row"
oCreationPackage.Enabled = True
oMenuItem = SBO_Application.Menus.Item("1280") 'Data'
oMenus = oMenuItem.SubMenus
oMenus.AddEx(oCreationPackage)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Else
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Try
SBO_Application.Menus.RemoveEx("OnlyOnRC")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
End If
End Sub
Menu Event...
If (pVal.MenuUID = "OnlyOnRC") And (pVal.BeforeAction = False) Then
Try
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Dim omat As SAPbouiCOM.Matrix
Dim GCols As SAPbouiCOM.Columns
Dim i As Integer
oitem = OForm.Items.Item("Ur Matrix")
omat = oitem.Specific
GCols = omat.Columns
omat = OForm.Items.Item(selItem).Specific
For i = 1 To omat.RowCount
If omat.IsRowSelected(i) = True Then
omat.DeleteRow(i)
Exit For
End If
Next
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
It will work..
Regards..
Billa 2007
Similar Messages
-
How to fill the first column '#' of matrix with row id in user form?
Hi All,
I am having a user defined form in which, I m having a matrix and m populating the matrix with the output of an sql query.
something like this:
SQL_Str= "select col1,col2,......from.... "
OPopDBTable.ExecuteQuery(SQL_Str)
oMatrix.AddRow()
oMatrix.Columns.Item("Col3").DataBind.Bind("PopTable", "col1")
oMatrix.Columns.Item("Col2").DataBind.Bind("PopTable", "col2")
oMatrix.LoadFromDataSource()
Now, in this, how can I assign row number to first column ('#' column ) ??
regards,
BinitaAh...the ROW_NUMBER() was posted by Petr - also thank you (again)
With my example-query from the other thread:
SELECT
CAST(
ROW_NUMBER() OVER (ORDER BY T1.U_LogNo ASC) AS INT
) AS RowCnt,
T1.Code,
T1.U_ParcelNo,
T1.U_LogNo
FROM
[@XXX_EXAMPLE] T1
WHERE
T1.U_ParcelNo='132006'
ORDER BY
T1.U_LogNo ASC
...this works for me (it's quickly copied from several subs/func. - I hope it's not too much disordered):
DtLogs.ExecuteQuery(query)
oMtxLogs.Columns.Item("0").DataBind.Bind("DT_LOGS", "RowCnt")
oMtxLogs.Columns.Item("1")........
oMtxLogs.LoadFromDataSource() -
Need dissociation street name and street number from one column?
Hi all,
I have one table A with one column with Street name and street number.
And I was adding second column and now need update this second column with street number
and delete street number from first column.
How can unpluging street name and street number from one column?
(street name are 90% char, number is 100 numeric, in 10% street name name
starts with number (1.HEROES 223, 1.HEROES 224...)
GordanHi,
Solution of Mr. Wijk come first, however I like to post (it's very similar and incomplete, I know...). Supose you have a table call address (use position -1 like Mr. Wijk to look backward). It's better in cases like '1.My Street 123' (the space before the number is very important)
SELECT substr(a.street_name,
1,
instr(a.street_name,
-1) - 1) street_name,
substr(a.street_name,
instr(a.street_name,
-1) + 1) street_number
FROM address a;Regards, -
How to get fourthly row (row4) first column value (col1) in matrix
Hi to all,
In FMS, how to get fourthly row (row4) first column value (col1) in matrix in document.
select $[$38.1.4]
But it display the first row
Please give me hint.
Thank youHi Eric,
FMS may only apply to current row. There is no way to get any other fixed row.
Thanks,
Gordon -
How to sort a 2 dim. array by the first column?
Hi there,
I need to know, how to sort a 2 dim. String array by the first column, which means "string[0][x]".
I think, I have to implement a new comparator class. But how?
Thanks in advance for any helpI need to know, how to sort a 2 dim. String
array by the first column, which means
"string[0][x]".You want to sort the array using the first element in each row and that element is a String?
Let's forget about generics. Say you want to supply a Comparator. The compare method should decide the order between elements when passed two element objects. In a two-dimensional array the elements will be one-dimentional arrays and you use the first element in those arrays, like
public int compare(Object s1, Object s2) {
String[] a1 = (String[]) s1; // first row array
String[] a2 = (String[]) s2; // second row array
return a1[0].compareTo(a2[0]); // compare first element of row arrays
} -
How to get ALV Display with First column alone in sort
How to get ALV Display with First column alone in sort
HI,
You can build Internal Table and send this to the parameter "IT_SORT".
eg:
"the sorting Internal Table structure is as whown below.
DATA: t_sort_info type slis_t_sortinfo_alv.
"Build the Sort Internal Table
t_sort_info-fieldname = 'CARRID'.
t_sort_info-subtot = 'X'.
append t_sort_info.
t_sort_info-fieldname = 'FLDATE'.
t_sort_info-subtot = 'X'.
append t_sort_info.
Then pass this "IT_SORT_INFO" table to the Function module "Reuse_alv_*". (Note send the body of the Internal table only like "<b>IT_SORT = IT_SORT_INFO[]</b>".
Here i am making ALV output sorted on CARRID & FLDATE.
You can specify only the First Column name for sorting.
Regards,
Manju
Message was edited by:
MANJUNATHA KS -
Finding the first unused number in a column
I am attempting to write a single SQL statement that can find the first unused number for a column. For example, for a column called BLOCKID, that contains these values...1,2,3,4,6,7,8...I would like to be able to insert a record with BlockID equal to 5. I can do this by writting a loop, but that seems quite inefficient (may have to loop hundreds of times or more to find the first available hole).
Any ideas? Thanks, Kieren
nullHere's one way
1. Get a list of row numbers for the table
2. Add an item to the list for 1 more than the largest id
3. Remove from the list all numbers already used
4. Use the smallest value of the list that is left.
As a query this would be:
SELECT MIN(BLOCKID) FROM
(SELECT MAX(BLOCKID) + 1 BLOCKID
FROM mytable UNION ALL
SELECT ROWNUM BLOCKID
FROM mytable MINUS
SELECT BLOCKID FROM mytable
Needless to say there should be a primary key or index on the BLOCKID column of 'mytable'.
Good luck!
null -
How do I get a column of alphanumerical to stay sorted? When I go to the next column, my first column gets mixed up.
For my purpose, I'll have to go back to Excel.
What is your purpose? Note that Numbers 3.0 does not have a multicolumn sort interface the way you have in Excel (or Numbers 2.3). But it is generally easy to accomplish what you need to do.
Say you have a column A on which you want an alphanumerical sort and within that you want to sort by B (the equivalent of Excel's "Sort by" A "Then by" B).
First do a single column sort by B. Then do a single column sort by A.
SG -
The "plays" column (also known as the number of plays column) is not saving not saving the number of plays (v 11.0).
My number of 'Plays' was not increasing anymore at some point after updating to Version 11. I had iTunes rev 11.0.1.12. Today I updated to the latest rev 11.0.2.26, and now the numer of plays is increasing, so they must have fixed the bug!
-
Sorting by the first column.
I renamed some of the files in my library. I was able to re-add the folder so now all the songs are in there twice. The first column has an exclamation point in a circle and I can clear them from the library. Sure would be nice to be able to search by that first column and group them up. that seems to be the only column that won't highlight. Is there any way to clean out these dead listings from my library?
Try this:
MacMuse: Getting rid of -
Unable to setup fixed number of report columns based on a dynamic query
Hi guys, I need to find a way to replicate below output. Unfortunately it cannot be done using the column group feature due the fact it will create not so many rows as I need. In the below case it would create
only four columns. I need 10 columns. Basically for 100 m 6 columns would remain blank . 8 for 200 m .I'm using SRSS 2008R2
Query results:
Race Name Ranking
100m Andrew 1
100m Rachel 2
100m Chris 3
100m Drew 4
200m John 1
200m Billy 2
Report output should look like:
Race 1 2 3 4 5 6 7 8 9 10
100m Andrew Rachel Chris Drew
200m John Billy
Any suggestions?As I understand, you want a fixed number (10) of columns and you want them whether or not there are 10 rows returned by your dataset for a given race.
What is your dataset?
What if your dataset returns 15 races of a given type? Do you want 15 columns then?
Assuming your dataset is TSQL, you can use a matrix in your report if you tweak your dataset query. First, you need to add a "default" set of data that guarantees your 10 columns. This can be done with a set of UNION statements:
UNION
SELECT '100m' AS Race, '' AS Name, 1 AS Ranking
UNION
SELECT '100m' AS Race, '' AS Name, 2 AS Ranking
UNION
SELECT '100m' AS Race, '' AS Name, 3 AS Ranking
UNION
SELECT '100m' AS Race, '' AS Name, 4 AS Ranking
UNION
SELECT '100m' AS Race, '' AS Name, 5 AS Ranking
UNION
SELECT '100m' AS Race, '' AS Name, 6 AS Ranking
UNION
SELECT '100m' AS Race, '' AS Name, 7 AS Ranking
UNION
SELECT '100m' AS Race, '' AS Name, 8 AS Ranking
UNION
SELECT '100m' AS Race, '' AS Name, 9 AS Ranking
UNION
SELECT '100m' AS Race, '' AS Name, 10 AS Ranking
This gives you the 10 columns. In the matrix, set row group to Race and column group to Ranking. Set the intersecting detail cell to:
=Max(Fields!Name.Value)
This will give you 10 columns unless you have more than 10 rows returned for a given race.
"You will find a fortune, though it will not be the one you seek." -
Blind Seer, O Brother Where Art Thou
Please Mark posts as answers or helpful so that others may find the fortune they seek. -
Why is my ping so high in the first column only when i do a tracert?
When i do a tracert my ping is really high in the first column only on each hop and then it drops to a respectable level. Does anyone know why it is like this on my 4G LTE device? On my dsl when i do the same ping test its pretty even across on each hop. This is what im seeing when i do a ping test on my 4G LTE device.
tracert www.yahoo.com
Tracing route to ds-any-fp3-real.wa1.b.yahoo.com [98.139.183.24]
over a maximum of 30 hops:
1 9 ms 3 ms 3 ms
2 1101 ms 34 ms 38 ms 193.sub-66-174-20.myvzw.com [66.174.20.193]
3 169 ms 55 ms 52 ms 49.sub-69-83-13.myvzw.com [69.83.13.49]
4 52 ms 56 ms 54 ms 194.sub-69-83-13.myvzw.com [69.83.13.194]
5 179 ms 58 ms 57 ms 101.sub-66-174-17.myvzw.com [66.174.17.101]
6 168 ms 57 ms 60 ms TenGigE0-0-1-0.GW14.BOS4.ALTER.NET [152.179.2.97
7 181 ms 58 ms 57 ms 0.ge-0-3-0.XL3.BOS4.ALTER.NET [152.63.17.130]
8 170 ms 59 ms 58 ms 0.ae3.BR1.NYC1.ALTER.NET [152.63.18.222]
9 177 ms 67 ms 59 ms ae11.edge2.NewYork.Level3.net [4.68.62.41]
10 * * * Request timed out.
11 * * * Request timed out.
12 * * * Request timed out.
13 192 ms 49 ms 60 ms ae-4-90.edge4.NewYork1.Level3.net [4.69.155.210]
14 185 ms 51 ms 60 ms YAHOO-INC.edge4.NewYork1.Level3.net [4.28.130.82
15 380 ms 73 ms 129 ms ae-5.pat2.bfz.yahoo.com [216.115.96.67]
16 339 ms 69 ms 146 ms ae-4.msr2.bf1.yahoo.com [216.115.100.73]
17 215 ms 152 ms 80 ms xe-5-0-0.clr2-a-gdc.bf1.yahoo.com [98.139.128.11
18 289 ms 217 ms 217 ms et-17-1.fab6-1-gdc.bf1.yahoo.com [98.139.128.47]
19 187 ms 87 ms 79 ms po-14.bas2-7-prd.bf1.yahoo.com [98.139.129.227]
20 474 ms 314 ms 294 ms ir2.fp.vip.bf1.yahoo.com [98.139.183.24]
Trace complete.hi there
see you never got an answer from vzw
take it you still have the high ping or no ping in my cases
your doing better then i
seems the lte is getting bad with this problem over time as my connection times out causing half loaded web pages and lots of buffering in video playback
i have had 3 tickets in the past 3 month to try and get this fixed but they say cant find anything wrong
and noone else is having the problem here are a few things that seems to have helped me out
1 increase your TTL time till live
this tells your computer to wait a bit longer before giving up and requesting that a packet of info be resent
2 in your computers network settings and reg you can change packet size to a smaller number and add a stop bit to the packet with a time stamp on each packet back in the old days this was what v 90 modems did to get v92 speeds and did help with noisy copper wire dial up and seems to help here too
http://www.dslreports.com/drtcp
is a tool that will help you change your computer setting and reg
use drtcp and the results from this page
http://www.dslreports.com/tweaks
xp win 7 win 8 this will help. vista did it right and dynamically change these settings on the fly and all of step 2 is unnecessary
remember your original settings write them down so you can go back to them should you have problems
also make a restore point and backup your reg before tinkering with windows os
send a private message to me if you need more help or get a computer savvy friend to help you out if you need
3 if your signal noise is under 4G -100bd the lower the better, there is a way to set your android to lte only mode.
more likely to lose data and voice in weak signal areas but great if tethering or hotspotting at home
dail *#*#4636#*#* this is a back door to your android software and is open source code by android os not vzw
and will not unlock your phone voiding warranties. be warned though if you set things wrong in here
you can make more problems be very sure what you change and do one thing at a time so you remember and can dial in again and change it back should you disable something you need. fyi each time you dial in the number it resets to vzw default setting and may look like it did not save setting but it doz. till you dial in again.
good luck
ron
ps im not a vzw rep in any way other then a fellow customer not getting answers. -
Problem with checkbox column in matrix
Hello.
I have a little problem with checkbox column in matrix.
Column is binded to the UserData.
It has ValOn="Y", ValOff="N".
I use C++. It is wird problem. In matrix I have 10 columns - scrollbar role and if You want see checkbox column, You must role to the right. If this column is on the screen, and I use:
checkcell->PutChecked(VARIANT_TRUE);
then the checkbox is cheched, and if the checkbox isn`t on the screen and I use this comment - it nothing happening.
I tried to use ValOn="Y", PutChecked...
The problem i solved if the column is on the screen - if the column is first in matrix or second, but if it`s last I have a big problem.
My column with checkbox is not editable, but I tried to make it editable, check it, and then make it uneditable - the same efect.
How can I solve it ?
Sorry for my english.
Kamil WydraHello Kamil,
I am not sure about your problem, but here is an example of how to use checkbox in UI API.
First, create the matrix with checkbox column in Screen painter, and the output is an xml file, like this. Type as 121 indicates that it is a check box.
- <column AffectsFormMode="0" backcolor="-1" description="" disp_desc="0" editable="0" right_just="0" title="Rented" type="121" uid="Rented" val_off="N" val_on="Y" visible="1" width="41">
<databind alias="U_RENTED" databound="1" table="@VIDS" />
<ExtendedObject />
Second, bind the column to table from DB. This is a bug of 2004 Screen Painter, so if you are using 2005 Screen Painter, there is no problem.
Third, when you open the form, you can check and uncheck the cell.
BTW, please set the editable of the column to true.
Hope this helps,
Nick -
How can i use Itemsyms in a first column?
I want to use use Itemsyms in my first column of mulitlist box. But it always exist with first content of ItemNames. I want to
know whether I can put a Itemsyms in a single column and data in other columns. Should i create a null string array and set it as
a first column? And the Itemsyms only can be put in the first column?
I feel confused now after try many times.
please give me help.
attached my vi.
By the way, When i try to set number of row and column of list box, for column, the set value is 5, but the value get from property is 4.
I don't know the reason.
thanks
br.
Attachments:
subvi_ListCheck.vi 16 KB
main.vi 11 KBmmm2006 wrote:
Hi,
Thanks.
How about other my questions? Please give me your advice.
Thanks.
mmm2006 wrote:
I want to use use Itemsyms in my first column of mulitlist box. But it always exist with first content of ItemNames. I want to
know whether I can put a Itemsyms in a single column and data in other columns. Should i create a null string array and set it as
a first column? And the Itemsyms only can be put in the first column?
I feel confused now after try many times.
please give me help.
I do not understand this term "Itemsyms".
If you create a "null string array", your first column will become empty. You want this way or you want to replace your data in the first column? Both are different...
You can very weel put your "Itemsyms" in a single column & data in others.
- Partha
LabVIEW - Wires that catch bugs! -
Read From Measurement File... removes X Values of first column?
During one of our tests, two instruments were switched at the terminal by accident. I need to read in the massive lvm files, remove the wrong scaling and apply the correct scaling, while switching the values in the columns and right it all to new files. Simple right?
I wanted to use the Read from Measurement File.vi to make things easier, because the files are very large and I would like to analyze them 100 rows at a time. Some of the the files are around 1.5 Gigs in size so I need to read them in chunks.
The read from measurement file keeps removing the first column from the data! It outputs the data as a signal (dynamic data) and I have to use the dynamic to numeric array express vi. For some reason, before I even get to that point, the first column is not in the data.
No matter what settings I pick on the read from measurement express vi, the time column is removed from the data. I have checked/unchecked the "first row is channel names" and "first column is time channel" to no avail. The odd thing is that in the preview it shows the first column, as if it will read it properly... but it doesnt. Nothing I change in the settings can seems to make a difference in getting the first column, the x values, out of the file.
Below you can see the first column completely removed from the data.
This is extremely frustrating. By probing the signal out I can see the dynamic data attributes and the time column has already been removed, so I don't think that the signal to double array express vi is the problem, but I am not sure.
I am attaching my VI and a small data file to be analyzed. You can see what I mean.
The alternatives seem less than adequate. The read from spreadsheet file vi wants an offset of a specific number of characters not rows. The problem is that this is not constant between rows for some reason, when hidden characters are taken into account so I cant just set the number of characters in 100 rows and increment the offset in a loop... like I normally would. That means I might miss data or get a corrupted row.
This means that I have to use the read from text file, read how ever many characters I think a row is (over estimating a bit) then search for the newline character, find out how many chars are in that set and then offset that for the next loop iteration, all while converting each string number to a double. Talk about slow.
I have searched around and found that I am not the only one that has had this issue. This is a common thing, but no one seems to have the answer. Why can't the read from measurement file VI read all of the numbers in every row? Why cant I tell it I want a 2d array of doubles out and not a dynamic data type? It has to be something I am doing wrong.
Attached is a zip file with my VI and two data files. The "S19_A_DSI_detensioning_c.lvm" is the one generated by my VI (_c meaning corrected). "S19_A_DSI_detensioning.lvm" is the original measurement file. I hope you will pardon my messy VI, it's a quicky.
Any help you guys can give would be much appreciated.
[will work for kudos]
Attachments:
Scaling Factor Correction.zip 1109 KBThat is a great workaround. The help talked about putting a check next to "read lines" but for the life of me I couldn't find where to do that. I wonder what other VIs have mystery check options in the right mouse click menu. I mean normally options like those are inputs, I thought. I'm going to start right clicking on every VI I drop to see if there are options there I never realized.
I would still have to use the set file position VI and specify the byte offset right? How would I know where that is? I guess each character is a byte and I would count the characters in the string retrieved and then offset by that amount on the next iteration using a shift register?
While waiting for help, I ended up using the read from text file and using the match string to look for the new line character, and using the spreadsheet string to array vi, analyzed the files line by line. Thats just because I couldn't easily come up with a regular expression to get 100 lines. It was slow but it worked.
However, that still really doesn't answer the question of why it is impossible to get the first column with the read from measurement file express VI. Does anyone know? Is this a known bug?
[will work for kudos]
Maybe you are looking for
-
Service Order not replicated in R3
Hello Gurus; Here's my scenario, i need a service order to be created in CRM and replicate in R3, i have no problem with the sales item but some struggle with the service item. I know that standard CRM wouldn't allow me to replicated object type BUS2
-
Email link to folder on shared volume
There's probably a really easy answer to this one but I just can't find it... so please be a hero and help me out! I need to email a link to a folder on a shared volume to a colleague, showing him where I've put a particular file. How do I do this ea
-
i keep getting this meesage appear: " '{' expected " everytime i try to run this code: public class PhoneBookIO private static final int MIN = 0; private static final int MAX = 4; // private static void main (String[]args); displayMenu(); public stat
-
how to add a new field in the search help exit which is not a part of the selection method??..explain with an example
-
System is up to date, but pacman still ask for downloading some pkgs
[root@arch pkg]# pacman -Su :: Starting full system upgrade... resolving dependencies... looking for inter-conflicts... Targets (4): glibc-2.10.1-3 zlib-1.2.3.3-3 binutils-2.19.1-5 db-4.7.25.4-1 Total Download Size: 18.93 MB Total Installed Si