Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Referencing previous data objects in functional map

Status
Not open for further replies.

jmaken

Programmer
Nov 28, 2003
3
US
I have a functional map, FM_CreateRecord(), that gets called with two arguments: (1) data object -- AMTLoop -- with range (1:s), and an integer index of the current AMTLoop via INDEX(AMTLoop). I'm trying to compare values in the current AMTLoop with the previous AMTLoop from within FM_CreateRecord but having difficulty with the scoping and syntax issues.

Suggestions on how to compare previous and current data object element values when you don't know how many data objects exist in the input file?

Thanks...
 
Hello

It should be possible to send the ATMLoop[LAST]:Input
as a reference to the functional map. So this way you should be able to use the values in this to compare with.

// Myggiz
 
Myggiz,

Thanks and just tried this and it didn't seem to help.

My understanding of LAST in Mercator is that if LAST is used as an index for an input object in a map rule, it actually references the very last occurence of the input data object rather than the previous data object....when used in a component rule it will refer to the last occurence found.

As I've got an unknown number of AMTLoop's in the input file and need to compare data from a current AMTLoop object with the previous AMTLoop object via a map rule, unfortunately using LAST and comparing a current AMTLoop object with the very last AMTLoop object won't work for me.

Other suggestions?
 
Ah.. sorry...
was mixing it up a bit!

Ok.. lets see .. first time around you dont do the
compare right ?
So ther might be a way depending on what you do with the data
you could use xxx[LAST]:eek:utput .. as this is constantly
filled with data .. and every record before the current one
will e the lastone in the output.
so if you have the data anywhere in the functional map
creating the output you might be able to use it.

if not you could add "dummy" fields to your output and
add a extra "cleaning" output card last in the map...

wonder if i make any sense here ;)

Do you follow me above ?




 
i can provide a short example of the above if needed...

// Roberth
 
I'd like to see your example. I had the same issue a while back and ended up doing something less than ideal but produced some benefits.

I built a concatination map that grouped common data objects together. It reduced the size of the input file which decreased processing overhead and overall performance. By concatinating based on the x12 loop structure it also allowed me to organize the input more effectively, minimizing code.

Again, it was less than ideal but.....

eyetry

 
Myggiz,

Interesting idea and I'll check out your post at the the other location now that I'm back from a biz trip.

I'm trying to keep the map self-contained if at all possible and I just can't believe that Mercator doesn't have a usable syntax for relative referencing of objects based on it's current context especially when it validates the input data (and therefore knows the input data structure) before it starts mapping the output data.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top