|
Rank: Newbie
Joined: 8/30/2011 Posts: 7 Location: Bellingham, WA
|
I am trying to grab only the first instance of an element from an xml document in Mapforce but I can't find a function in the default set libraries that does this. Does anyone know how to create a custom User-Defined function that can do this or any other way to accomplish this?
There is also a chance that these elements might occur in separate locations. E.g. There is 3 Person elements (<Person id="1"> <Person id="2"> <Person id="3">) and all might have a single FirstName element, but I just want the <Person id="1">'s FirstName element. So the row position of each FirstName element is 1, even though there are three of them that occur throughout the document.
Also does anyone know of any websites with some good information on the syntax used in a custom User-Defined function?
|
|
Rank: Advanced Member
Joined: 12/13/2005 Posts: 2,856 Location: Mauritius
|
Use Filter
|
|
Rank: Newbie
Joined: 8/30/2011 Posts: 7 Location: Bellingham, WA
|
Thank you Vlad. I am very new to Mapforce and when I insert the Filter:Nodes/Rows I do not know how to get it to filter out additional elements. I see there is an input for Node/Row and an input for bool, then two outputs, on-true and on-false. Could you provide me with a little more detail? Thank you
|
|
Rank: Advanced Member
Joined: 12/13/2005 Posts: 2,856 Location: Mauritius
|
You will find everything you need in documentation, examples, free online training. Even if you try to search in this forum - you will find tens of the very same question of newbies. Somehow nobody wants to learn product first, even though MapForce is soooo easy.
|
|
Rank: Newbie
Joined: 8/30/2011 Posts: 7 Location: Bellingham, WA
|
I have looked at some of the examples. Most notably the row position one, which won't work in my case since the row position of the elements will always be one. I tried the is-xsi-nil but when I set that to Document B's element (I am trying to see if the element has been mapped yet) and the result to the bool input of the filter I keep getting a circular reference error. I have looked around at the documentation and examples but feel like they don't cover what I am trying to do, which is why I asked a question here.
|
|
Rank: Advanced Member
Joined: 12/13/2005 Posts: 2,856 Location: Mauritius
|
I don't understand. You want an id equal 1, and in order to achieve this you are trying position or is-xsi-nil??? Where is the logic?
Don't be lazy - at least go through examples in Filter and Condition folder of Examples project - you will find enough similar ones.
|
|
Rank: Newbie
Joined: 8/30/2011 Posts: 7 Location: Bellingham, WA
|
I must be missing this examples folder. I looked into Program Files\Altova\MapForce2011 and found nothing. Do you have a favorite online resource you use for MapForce? The included help file has only been minimally helpful.
Also, I won't always know the id value of the person. This mapping will be re-used numerous times and people might populate the id attribute with different values, which is why I was checking to see if the element is populated first.
|
|
Rank: Advanced Member
Joined: 12/13/2005 Posts: 2,856 Location: Mauritius
|
>I must be missing this examples folder It's on your disk, and MapForce opens Examples project automatically right after installation. Repeat installation if you have no idea where to look for it. According to Microsoft guidelines modifiable files should never be placed under Program Files, therefore examples are not allowed to be installed there.
>The included help file has only been minimally helpful. The included help contains section which discusses almost exactly your issue
>Do you have a favorite online resource you use for MapForce? Did you actually read my advise to search in this forum? Oh did you use my another advise to take free Online Training?
I give up, I'm tired of answering obvious questions.
|
|
Rank: Newbie
Joined: 8/30/2011 Posts: 7 Location: Bellingham, WA
|
vlad wrote:>I must be missing this examples folder It's on your disk, and MapForce opens Examples project automatically right after installation. Repeat installation if you have no idea where to look for it. According to Microsoft guidelines modifiable files should never be placed under Program Files, therefore examples are not allowed to be installed there.
>The included help file has only been minimally helpful. The included help contains section which discusses almost exactly your issue
>Do you have a favorite online resource you use for MapForce? Did you actually read my advise to search in this forum? Oh did you use my another advise to take free Online Training?
I give up, I'm tired of answering obvious questions.
Yes I read your post and I searched the forum for filter examples. Here are the results it came up with https://www.altova.com/forum/default.aspx?g=search On the first ten, not a single one contained an actual example.
As for the help file's filter section, http://manual.altova.com/Mapforce/mapforce-professional/index.html?mfffilteringdata.htm it is not relevant to my question as does not help me at all. Lastly, I don't have the installation CD, its an ISO on a different server which I don't have access too. I'm sorry if this question is too obvious but at this point it seems like it would have saved us both a lot of time if you would have provided a simple example rather then telling me places to look. I have looked in those places, provided links above, and none of them contained answers to what I was looking for.
|
|
Rank: Advanced Member
Joined: 12/13/2005 Posts: 2,856 Location: Mauritius
|
Why is this help section not relevant? What is different in your case? Show us a screenshot with your mapping and explain. Your textual description made me think that it is a perfect fit.
|
|
Rank: Newbie
Joined: 8/30/2011 Posts: 7 Location: Bellingham, WA
|
I got it figured it out. I used a filter, an equals to, and the position of the parent element to grab the first element (circled in red). Here is the screenshot. http://i.imgur.com/qvexZ.png
Warning: this is my first attempt at mapping anything in MapForce so its ugliness might cause temporarily blindness. If anyone has any suggestions on how to clean up the cluster mess of mapping and functions, please let me know. I am still only about a third of the way done with the mapping and will be adding tons more boxes and connectors to the UI.
|
|
guest |