Is there a better way than the following of detecting in the calling activity that a called connect-file rule has encountered a duplicate file name?
When writing the first record to the file, I call a connect-file rule with the "if file already exists" option set to "fail". I have left the Status Message Property set to the default .pyStatusMessage property (and the Status Value Property set to .pyStatusValue).
In the calling activity, even when a duplicate file name is found I still get a StepStatusGood returned, so in order to detect that the "fail" has been triggered I have coded a When condition of @equalsIgnoreCase(@substring(myConnectFilePage.pyStatusMessage,0,7),"Created") - when this returns false this means that a duplicate file name has been found. (Note that myConnectFilePage is the name of the step page used to call the connect-file rule.)
Thanks for your advice - I'm already doing something similar in checking StepStatusGood to ensure that the Connect-File method has completed with no exception. Unfortunately .pyStatusValue returns "Good" whether or not a duplicate file name is found (the same is true for .pxMethodStatus, which is what StepStatusGood checks).
Thus neither .pyStatusValue nor .pxMethodStatus is of use to the calling activity in indicating the presence of a duplicate file name.
The full message returned in .pyStatusMessage is as follows when attempting to write the first record to a file (note that <filename> would be replaced by the relevant path & file name at runtime)...
When file does not already exist: "Created the file <filename> and the source data is written to it."
When file already exists: "File <filename> already exists...no write operations are performed"
i am also facing this problem can u provide example of screenshots.
if file is exist on locaton(filepath) it's not throwing any error msg..and pyStatus="good" only but i want if i transfer duplicate file i want to show some error msg r pyStauts="fail"...then what am do..please help me...anyone
Hi Ramesh. No-one came up with a better way of checking for a duplicate file name than the one I described (i.e. checking for pyStatusMessage starting with something other than "Created" when attempting to write the first record to the file). Here is a screen dump of an example - note that the second part of the transition in step 7.6 checks for the message starting with "Created" and jumps to error processing if this is NOT found.