Skip to main content
I am attempting to write a line rule that compares the Process.Attachment to the Activity.Attachemtn to check if a change has taken place to the attachment.

I tried to do it using the regular line rule wizard and it doesn't appear to be working.

Any ideas?
I do not know what your environment looks like? You need to give us more information on what you want to achieve. Files can be compared with a lot of methods. (Binary etc.) You can save data in K2.net datafields or on a SPS server whitch gives you versioning etc. Use the line rule to test previous saved data in k2datafields/k2xmlfields before you go to the next activity.

Thanks

David
Our process requires that the approver of a particular document must be able to change the document and then approve it. If the document is changed and then approved the document will be uploaded to Sharepoint (as a new version) and the originator will receive an email that the document was changed before being approved.

I have the upload and the email covered.

So what I am trying to do is compare the binary of the file that was attached to the infopath form before the activity with the binary of the file that is attached to the infopath form after the activity. If they are different then upload and send the email, if they are equal then proceed to the next activity.
Here is an example on how to compare two files. You can use this in the activity line rule (edit the code) and compare the files.

To use this program, specify the names
of the files to be compared on the command line.

For example:
CompFile FIRST.TXT SECOND.TXT

, FileMode.Open);  
} catch(FileNotFoundException exc) {
Console.WriteLine(exc.Message);
return;
}
} catch(IndexOutOfRangeException exc) {
Console.WriteLine(exc.Message + "
Usage: CompFile f1 f2");
return;
}

// Compare files
try {
do {
i = f1.ReadByte();
j = f2.ReadByte();
if(i != j) break;
} while(i != -1 && j != -1);
} catch(IOException exc) {
Console.WriteLine(exc.Message);
}
if(i != j)
Console.WriteLine("Files differ.");
else
Console.WriteLine("Files are the same.");

f1.Close();
f2.Close();
}
}

Thank you for the example. It turns out we ended up using another field to check for changes.

Reply