Sorting n:m Mapping
Hi,
I try to sort an n:m mapping.
The Toplink Workbench has an Sorting Option for
n:m mapping, but I need to sort for an attribute which
is located in the reference Table.
The QueryKey-ComboBox of the Collection Properties Tab
does not contain the Attributes of the Reference Table, it only contains the Attributes of the Target Table.
Could I set a default sorting for an n:m Mapping?
The M:M mapping is intended for situations where the join table only has the foreign keys for both sides of the relationship. As soon as you add additional columns to this table it is not possible to have TopLink insert or update these values.
For this reason it is recommended to add a class to your model that is mapped to this table, which now contains application state. This will then allow you to populate the value on write and sort on the value during read.
Doug
Similar Messages
-
DTW Sort Error - after mapping during import
I got the "Sort Error - after mapping during import" message in DTW. (version 8.8)
I would like to import warehouse info for items.
My itemcodes are fix 15 character numbers, like this: 10204150020011
The note nr. [1331130|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/oss_notes/sdn_oss_sbo_dtw/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d31333331313330%7d] said that I can't use recordkey like this.
Do you have any idea how can I import thees information with DTW?
Thank you,
Attila SarkadyDear All
Please give correct and complete information
i have tested every kind of combination;
- recreate the template with the dtw for Items = i have UDF's
- ADD the column RecordKey !!! unbelievable that we have to do this
- i have entered a nr 1 in it (even when we had already 850 items in the database)
(and of course the hints of Gordon - columns as text, start with basic... - and use CSV format)
now at last i can import the record line
greetings
philippe -
Complex string pattern match/sort question for mapping data - Exchange Enable mailbox use case
Hi, Im trying to do a runbook to Enable mailbox for a user. Our Exchange Admin uses a rule/formula to allocate the mailbox database based on users first name and this is what I am having difficulty replicating in Orchestrator to add the correct
data in the Database property of Enable Mailbox activity.
The Rule exchange uses, takes up to the first 3 chars of forename and based on an alphabetic sort, it will allocate to a particular mailbox db (we have a quite large Exchange Org with 20k users so hes tried to allocate about 500 users per mailboxDB). so
for example User Forename A-ALI = DB1, ALL-ANG = DB2, ANH-ANY=DB3,AO-BER=DB4 etc etc.
So I was hoping someone could advise of some string comparison activities native in Orchestrator or maybe done as last resort in powershell (as I'm not great in powershell) to provide a map of the published data for forname to appropriate mailbox matrix.
Any help on this would be much appreciated...
CheersYou could use the built in Mid function [Mid(‘Return subset from this string’,1,3)] to get the first three letters of their name and honestly I would send
this to the Run .Net Script activity using powershell myself and do a select case to get it to publish to the database the name of the database server.
I am all for using built in activities to do things in Orchestrator but you are going to quickly find that you need to have good powershell scripting skills to extend the tools beyond the capabilities of the built in activities.
Vaughn -
Using SORT function in mapping
Hi,
I am having trouble getting my head around using the SORT function.
My interface is IDOC to File, The IDOC has a repeating segment (PAYLOAD) that can be of 3 types, either type A, B or C (this is set using a "TYPE" field).
In my file structure I have a repeating "ROW" element which has all of the fields for each row.
I want to group all the Type A data together, the Type B together and the Type C.
I have tried the following mapping on the "ROW" element but it doesn't seem to work:
"TYPE"--"sort"Split By Value (Value Change)--collapseContext--"ROW"
for each of the mappings under ROW I just have fields copied directly.
I think I am doing something wrong.
Thanks.Hi,
You could make this mapping
TYPE --- +----------------+ +----------------+
| | | |
| Concat | --- | mySortFunction | --- NAME
| | | |
NAME --- +----------------+ +----------------+
TYPE --- +----------------+ +----------------+
| | | |
| Concat | --- | mySortFunction | --- ADDR
| | | |
ADDR --- +----------------+ +----------------+
Where source code of mySortFunction is like this:
public void mySortFunction(String[] inputValues,ResultList result,Container container){
for(int i=0;i<inputValues.length;i++)
if(inputValues<i>.substring(0,1).equals("A"))
result.addValue(inputValues<i>.substring(1, inputValues<i>.length-1);
for(int i=0;i<inputValues.length;i++)
if(inputValues<i>.substring(0,1).equals("B"))
result.addValue(inputValues<i>.substring(1, inputValues<i>.length-1);
for(int i=0;i<inputValues.length;i++)
if(inputValues<i>.substring(0,1).equals("C"))
result.addValue(inputValues<i>.substring(1, inputValues<i>.length-1);
It is very simple. You concat TYPE whit your data, and then you sort all queue, so you have a new sort queue data. You must only then put out data. -
Dear Experts,
I have a table with four fields Project (String), Task (String), StartDate (Date), EndDate(Date)
I need to find Task in each Project having the earliest StartDate and the latest EndDate
Example
LA1C3TINT,B1CYSPOW10,11/15/1999,11/15/1999
LA1C3TINT,B1CYSPOW10,11/15/1999,11/15/1999
LA1C3TINT,B2CYSPOW10,7/15/2000,7/15/2000
LA1C3TINT,B2CYSPOW10,7/15/2000,7/15/2000
LA1C0JGEO,0CGQS2MHL100,3/25/2002,11/23/2004
LA1C0JGEO,0CGQS2063001,3/25/2002,11/23/2004
LA1C0JGEO,0CGQS2063002,3/25/2002,11/23/2004
I was thinking of storing them in map to array, with Project as key
However I don't think I can actually mix type of data in an array, provided I can sort date in array ????
Any pointers will highly be appreciatedMake a class that encapsulates whatever this thing is, either make it Comparable or write a Comparator class, and sort it using either a List or a SortedSet.
-
I have a hashmap with strings as keys, and float values as values, like below:
{"anne=0.23453, barry=1.254339,steven=0.12449... }
what i want to do is sort this hashmap according to the float values, returning the highest float value first. What i am currently doing is, swapping the keys with the values, so that the floats are the keys, and sorting them with a hashmap:
Set set = map1.keySet();
Map invertedMap = new HashMap();
for(Object o : set)
float val = (Float)map1.get(o);
invertedMap.put(val, o);
TreeMap sorted = new TreeMap(Collections.reverseOrder());
sorted.putAll(map1);
Set set1 = sorted.keySet();
Iterator it = set1.iterator();
while(it.hasNext()) {
Object o = it.next();
System.out.println( o + " " + map1.get(o));
}The problem here is that in the hash tables there a few floats are the same value, ie henry=1.6743, and mary=1.6743
so when i invert the hash table, making 1.6743 one of these is ignored. Can anbody think of a way i can do this?
Id appreciate any help
ThanksThanks, ive stored the entrySet in a list. A little
unsure how to go about writting comparator to sort
them by value though. Would you be able to explain
this in a little more detail, please?Write a class that implements java.util.Comparator. Thre's but one method to implement, that is
public int compare(Object o1, Object o2);
Expect the arguments to be keys in your map. Fetch the value for each key and compare the values. That should be a problem since, if I got it right, those are java.lang.Floats, which implement java.lang.Comparable, so you can simply return: value1.compareTo(value2).
Take a minute or two to read the Javadoc of the Comparator's compare method. -
How to disable sorting in hash map
im adding like this ,
Map Params = new HashMap();
params.put("orderYear", "1");
params.put("distrChannel", "2");
params.put("salesOffice", "3");
while iterating answer is coming like this
1
3
2
but i want
1
2
3
thanks in advance
gowriwhile iterating answer is coming like this
1
3
2You can print the Sorted HashMap values using the following way:
HashMap map = new HashMap();
map.put("1","First");
map.put("2","Second");
map.put("3","Third");
ArrayList keys = new ArrayList();
keys.addAll(map.keySet());
Collections.sort(keys);
Iterator it = keys.iterator();
while (it.hasNext())
System.out.println(it.next());
Refer the outcome keys, and print the HashMap values, thats all. -
Regarding Month sorting in List Map String, Object
Dear All,
i have a list which is- List<Map<String, Object>> results . What i need is i want to sort the 'results ' .The values in results, when i tried to print it are
RESULTS :{Apr 2009}
RESULTS :{August 2008}
RESULTS :{December 2008}
RESULTS :{Feb 2009}
RESULTS :{Jan 2009}
RESULTS :{Jun 2009}
RESULTS :{Mar 2009}
RESULTS :{May 2009}
RESULTS :{Nov 2008}
RESULTS :{October 2008}
RESULTS :{Sep 2008}
i want to sort the values according to the month. like jan 2008,feb 2008 etc .
Somebody please help .
Thanks in advanced .sha_2008 wrote:
The output sholud be june 2008,Dec 2008, Mar 2009. ie according to the increase order of monthsThat doesn't make it any clearer, in the example "June 2008" and "Mar 2009" are in the same map. Do you want that map to appear both before and after "Dec 2008" which doesn't make sense or are you expecting to restructure the data. If so, I would suggest you use a SortedMap like;
List<Map<String,Object>> maps = ...
SortedMap<String, Object> results = new TreeMap<String, Object>(dateComparator);
for(Map<String, Object> map: maps)
results.putAll(map);BTW: is there any good reason your dates are Strings instead of Date objects which are much easier to sort? -
Hi,
My interface (JDBC to File) from source side I am having 3 fields and from target side I am having 2 fields.
Thing is that if third field (Unbranded Material Number) having some value then we have to create new record from target side with plant and product. I am able to do that with Context Change..
I am getting the proper o/p but not in proper format.
I/p
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_Plant2product xmlns:ns0="urn:bp:xi:dwn:re:cbt:alps:planttoproduct:100">
<Item>
<PLAN>1</PLAN>
<MATERIAL_NO>2</MATERIAL_NO>
<UNBRND_MATERIAL_NO>3</UNBRND_MATERIAL_NO>
</Item>
<Item>
<PLAN>a</PLAN>
<MATERIAL_NO>b</MATERIAL_NO>
<UNBRND_MATERIAL_NO/>
</Item>
<Item>
<PLAN>x</PLAN>
<MATERIAL_NO>y</MATERIAL_NO>
<UNBRND_MATERIAL_NO>z</UNBRND_MATERIAL_NO>
</Item>
</ns0:MT_Plant2product>
O/p which is coming
<MTPlanttoproductPROS>
<Plant_Product_Record>
<PLANT>1</PLANT>
<PRODUCT>2</PRODUCT>
</Plant_Product_Record >
<Plant_Product_Record>
<PLANT>a</PLANT>
<PRODUCT>b</PRODUCT>
</Plant_Product_Record >
<Plant_Product_Record>
<PLANT>x</PLANT>
<PRODUCT>y</PRODUCT>
</Plant_Product_Record >
<Plant_Product_Record>
<PLANT>1</PLANT>
<PRODUCT>3</PRODUCT>
<Plant_Product_Record>
<PLANT>x</PLANT>
<PRODUCT>z</PRODUCT>
</Plant_Product_Record>
</MTPlanttoproductPROS>
I want O/p something like that
<MTPlanttoproductPROS>
<Plant_Product_Record>
<PLANT>1</PLANT>
<PRODUCT>2</PRODUCT>
</Plant_Product_Record >
<Plant_Product_Record>
<PLANT>1</PLANT>
<PRODUCT>3</PRODUCT>
</Plant_Product_Record >
<Plant_Product_Record>
<PLANT>a</PLANT>
<PRODUCT>b</PRODUCT>
</Plant_Product_Record >
<Plant_Product_Record>
<PLANT>x</PLANT>
<PRODUCT>y</PRODUCT>
<Plant_Product_Record>
<PLANT>x</PLANT>
<PRODUCT>z</PRODUCT>
</Plant_Product_Record>
</MTPlanttoproductPROS>Hi Anuj,
I have resolved your mapping issue using 3 UDFs.
1.Context <b>NodeUDF</b>
This UDF used to derive <b>Plant_Product_Record</b> node in Target.
UNBRND_MATERIAL_NO -> NodeUDF -> removeContexts->Plant_Product_Record
<u><b> UDF Code:-</b></u>
if((a[0].trim()).equals(""))
result.addValue("");
else
for(int k = 0;k< 2;k++)
result.addValue("");
2. Context <b>PlantUDF</b>
This UDF used to populate values in <b>PLANT</b> element in Target.
PlantUDF takes 2 inputs - <b>PLAN</b> and <b>UNBRND_MATERIAL_NO</b> from Source
2 inputs ->PlantUDF->PLANT(Target)
<u><b> UDF Code:-</b></u>
if((b[0].trim()).equals(""))
result.addValue(a[0]);
else
result.addValue(a[0]);
result.addValue(ResultList.CC);
result.addValue(a[0]);
3. Context <b>ProductUDF</b>
This UDF used to populate values in <b>PRODUCT</b> element in Target.
PlantUDF takes 2 inputs - <b>MATERIAL_NO</b> and <b>UNBRND_MATERIAL_NO</b> from Source
2 inputs ->ProductUDF->PRODUCT(Target)
<u><b> UDF Code:-</b></u>
if((b[0].trim()).equals(""))
result.addValue(a[0]);
else
result.addValue(a[0]);
result.addValue(ResultList.CC);
result.addValue(b[0]);
Please let me know if you have any doubts in this solution.
Cheers,
Jag -
I need to sort the incoming file contents before message mapping
Hi All,
I have requirement like i have to sort the file contents before message mapping in Xi. is there any option please suggest me with your value information.i dont want to sort in message mapping before that i want file contents to be sorted order.waiting for your quick reply.
Thanks,
seshagiriHi,
You can do this in one scenario.
Lets say you have MT_Source and MT_Target as two message types.
Now your MM1 will be between MT_Source & MT_Source, that is same message type. Here you built your sorting logic.
Now create MM2, between MT_Source & MT_Target. Here your actual mapping logic will be implemented. The input payload for MM2 will be sorted data.
Now in operation mapping, first call MM1 and then call MM2 (You have a plus + sign to add multiple mapping programs). Due to this sequence, at run time first MM1 will be executed and after that its oupt will be given to MM2 as source payload.
Hope its clear. Plz let me know if you have any doubts.
-Gouri -
Hello,
I have the following map:
Key Values
"String1" 1
"String2" 8
"String3" 3
"String4" 7
"String5" 3
"String6" 1
As you can see all the KEY are unique STRINGS and the Values are non UNIQUE INTEGERS. I want to sort(descendent) this map BY VALUE.
I have tried a lot of methods but I did not reach in a clear Result.
Please help me by giving source code.
I would also you to check if the following Comparator class is suitable for my problem
class FrequencyComparator implements Comparator{
public int compare(Object firstObject, Object secondObject){
Map.Entry first = (Map.Entry)firstObject;
Map.Entry second = (Map.Entry)firstObject;
if (Integer.parseInt(first.getValue().toString()) < Integer.parseInt(second.getValue().toString()))
return -1;
if (Integer.parseInt(first.getValue().toString()) == Integer.parseInt(second.getValue().toString()))
return 0;
return 1;
Thanks in advanceCrossposted,
http://forum.java.sun.com/thread.jsp?forum=31&thread=425045&tstart=0&trange=15 -
Help needed for storing and sorting objects.
Hello
I have an assignment and it is to create a guessing game, here is the question,
In this assignment you are to write a game where a user or the computer is to guess a random
number between 1 and 1000. The program should for example read a guess from the keyboard, and
print whether the guess was too high, too low or correct. When the user has guessed the correct
number, the program is to print the number of guesses made.
The project must contain a class called Game, which has only one public method. The method must
be called start(), and, when run it starts the game. The game continues until the user chooses to
quit, either at the end of a game by answering no to the question or by typing 'quit' instead of a
guess. After each game has been played, the program is to ask the user for a name and insert this
together with the number of guesses into a high score list. When a game is started the program
should print the entire high score list, which must be sorted with the least number of guesses first
and the most last. Note, the list must be kept as long as the game-object is alive!
each score also
consists of the game time. In case there are two high scores with the same number of guesses, the
game time should decide which is better. The game time starts when the first guess is entered and
stops when the correct guess has been made. There should also be input checks in the program so
that it is impossible to input something wrong, i.e. it should be impossible to write an non-numeric
value then we are guessing a number, the only allowed answers for a yes/no question is yes or no,
every other input should yield an error message an the question should be printed again.
I understand how to code most of it, except I am not sure how to store the playerName, playerScore, playerTime and then sort that accordingly.
I came across hashmaps, but that wont work as the data values can be the same for score.
Is it only one object of lets say a highScore class, and each time the game finishes, it enters the values into an arrayList, I still dont understand how I can sort the array all at once.
Should it be sorted once for score, then another array created and sorted again, I dont get it I am confused.
Please help clarify this.Implode wrote:
We had the arrayList/collections lecture today.
I asked the teacher about sorting objects and he started explaining hashmaps and then he mentioned another thing which we will only be learning next term, I'm sure we must only use what we have learned.
How exactly can this be done. I have asked a few questions in the post already.
ThanksWell, there was probably a gap in the communication. Hash maps (or hash tables, etc.) are instance of Map. Those are used to locate a value by its unique key. Generally, to speed up access, you implement a hashing function (this will be explained hopefully in class). Think of name-value pairs that are stored where the name is unique.
Contrast this with items that are sorted. Any List can be sorted because its elements are ordered. An ArrayList is ordered, generally, by the order you inserted the elements. However, any List can be given its own ordering via Comparable or Comparator. You can't do this with an ordinary Map. The purpose of a Map is speedy access to the name-value pairs, not sorting. The List likewise has different purposes, advantages, disadvantages, etc. List can be sorted.
A Map is generally similar to a Set. A Set is a vanilla collection that guarnatees uniqueness of each element (note, not name-value pairs, but simple elements). There is one concrete class of Map that can be sorted, TreeMap, but I doubt your professor was referring to that. The values or the keys can be returned from the Map and sorted separately, but again, I doubt he was referring to that.
Take a look at the Collections tutorial here on this site or Google one. It is fairly straightforward. Just keep in mind that things (generally) break down into Set, Map and List. There are combinations of these and different flavors (e.g., Queue, LinkedHashMap, etc.) But if you can learn how those three differ, you will go a long way towards understanding collections.
(Oh, and be sure to study up on iterators.)
- Saish -
Sorting incoming files based on payload content
Hi,
I have a file>XI-> FILE scenario...I need to sort the incoming file based on payload content...But my understanding is in XI each line item would be processed one at a time...Is it possible to sort the entire file before beginning to process???
-KenHi Ken,
you can try to create generic content sorting with java mapping:
/people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping
Regards,
michal -
Can't add row using table sorter
I had a jtable with my own mytableModel that implements AbstractTableModel. In mytableModel, I have addRow, removeRow... so I can delete/add row dynamically by calling mytableModel.addRow(..). Everything works fine.
However, after I added the table sorter and table map (got the code from the tutorial).
MyTableModel myModel = new MyTableModel();
TableSorter sorter = new TableSorter(myModel);
JTable table = new JTable(sorter);
sorter.addMouseListenerToHeaderInTable(table);
Now, when i call mytableModel.addRow(..), it doesn't work anymore. It doesn't add a row anymore, why?
Thank you so much for your help.I don't have a addRow method in TableSorter. My addRow method is in myTableModel. So, when I need to addRow, I called myTableModel.addRow, In my addRow method, I have fireTableRowsInserted method. This used to work using integrating with TableSorter.
Do I need to move all my addRow, addCol....DelRow... to TableSorter? The table data are stored in myTableModel. I guess I really doesn't know how the TableSorter work :(
Thanks -
First of all, is there any way to do it? does premiere have the ability to read in a track and select markers for the beat? I can understand if this is impossible. Is there a program in which i can utilize its beat mapping capabilities but then bring it into premiere so i can edit video to the beat more effectively? or, is there a way to place the marker at set increments of time, so, for instance i can find the exact time between beats, and merely move the selector(for lack of proper term) and paste the small clip or whatever after it, in succession? Or basically has anyone found an easier way of doing this besides staring hard at the wave form and supposing where the beats are? Thanks so much!
I believe that Magix Music Studio (name might have changed, as they rolled two similar programs into one) does have automatic beat mapping. In Premiere (and Audition, I think) you need to do it manually.
Also, SonicFire Pro 5 allows all sorts of beat mapping and also beat changes. The downside is that it works with their Strata (multi-layer) Series of music. If you are not using your original music, or existing music, take a look at their tutorial on SonicFire Pro 5 at their site, www.smartsound.com to see the power and features.
Hunt
PS, SmartSound is also having a big sale on a lot of their music right now. Price is as low as I've ever seen it, and they even have some of their "Backstage" music on sale. You have to register for access to that part of the site, though.
Maybe you are looking for
-
Photoshop Installation Failed message
I've tried installing Adobe Photoshop CS6 twice from the Application Manager and constantly receives: "Installation Failed" Unable to extract files. Press Retry to download again or contact suctomer support (EX20). I'm using a PC 32bit computer. C
-
Need a method for importing Palm III data into a Palm Centro
I just bought a Palm Centro (Verizon), with the expectation of importing data from my old Palm III. From the Palm III Desktop, I exported Contacts, Calendar, Tasks, and Memos into separate folders (this was done on a Windows XP PC) and copied the re
-
Move the CTI one frame at a time short cut
Is there a short cut key to move CTI one frame at a time? I am an After Effects guy and very much used to move one frame at time using the shortcut keys. New to Animate CC... I haven't been able to figure out that feature in Animate CC. Any help for
-
Synchronization parameter in lock object
what if we give initial value to this parameter ,the lock deleted asynchronously , i am not getting the meaning of asynchronously
-
Pull images from SQL/PHP into Flash
I have a website that displays images that are stored in a SQL database using PHP as a method for pulling and displaying the images. These images are stored in the database as text (ex: image1), then the PHP looks for the image like this: <img src="i