Line compare on a DataPort

In my DataPort I am Using Purchase Receipt line to calc some variables. But in DataPort Output all Varibles are ok, but as I am using the Purchase Receipt line, I have as much dataport lines, as much Purchase Receipt line’s.

I am thinking: in In OnBeforExport trigger keep the values ​​of my variables in the previous line and then compare the values ​​of the current line with the previous line, if they are equal currdataport.skip.

But How can I do this compare in a Dataport?

one approach, you can have 1 var, e.g. lastline (code).

in onafterexport, at any line, assign lastline to contain PO No.+Line No.
in onbeforeexport, make condition if lastline = PO no.+Line no. then currdataport.skip

check also on the value format in this case.

Hello Joe

I’ve tried this:

Purch. Rcpt. Line - OnBeforeExportRecord()

PO:= ((“Purch. Rcpt. Line”.“Document No.”) + FORMAT(“Purch. Rcpt. Line”.“Line No.”));
IF PO= LastLine THEN

CurrDataport.SKIP;

Purch. Rcpt. Line - OnAfterExportRecord()

LastLine:= PO;

But how do I know that is the last PO line?

Why not just use the Purchase Receipt Header as your data item? You can create a global variable for the Purchase Receipt Lines. Filter it on your current header and calculate your values using that variable. If you’re expecting one line per document then start with the table that only has the document number in it one time.

i’m giving the idea by using PO. lets say that the value you want to check is fieldX. when the code runs for the 1st time, var lastline is blank.

onbeforeexport, when you check lastline = fieldX - which is false - then the code runs and not skip.
to keep the lastline, you need to assign fieldX to lastline in onAFTERexport.

so that on the 2nd run and so on, lastline contain the previous fieldX value.

check on what Matt suggest also, since you know best what you are trying to achieve.

Hy Joe

I have done what you suggest, but when i get the last record line of a Purchase Order , the export process is execute. So I must check one more time and on the last chek the dataport export that record. How can I do That?

I’ve been following this post lightly…browsing over here & there.

I’m not understanding the need to compare?
What if the lines are #1 & #3 that are the same how will you find that?

Are you grouping item #'s?

Usually I use dataports for some basic importing & exporting - occasionally a complicated one.

But if needs gouping & totaling I find using a report & WRITE much easier way to go.

Hello

Thanks for your attention on this issue.

The question is that I created a Dataport, because I need to export to a TXT file some information to be sent to a Bank.

On thar Export file, I calculated 6 variables that depends on the purchase line information. For Each Purchase line, one variable is calculated. On the end of the lines, all my variables are calculated, and so I want to see them on my TXT File.

The problem is: For each line in Purchase line, one varivle is calculated and is printed is txt file, but I only want all varibles to be printed on the end of each Purchase Line.

I Don’t Know if it is the best way to do it, but the question is that for each purchase line, the last line in txt file is the perfect one and is correctly calculated, but how can I avoid other lines?

Thanks