Extraneous Zero LengthBlank Lines In Custom FF Output

I’m working with a custom FF schema, and I’m having an output problem that I’m hoping someone can help me with.

I have a service that takes in an ANSI 4010 X12 850 document, maps it to my custom FF schema, and puts out the result to a file.

When I open the file I see random blank lines added to the file. The rest of the output looks fine, but I’m mystified about where the extra blank lines are coming from.

I can run a test where I take in an instance of the custom FF, parse it, and immediately put it back out again. If I read the input instance into a Java app and ask what the last character is for each line there don’t appear to be any extra CR/LF in there.

Yet when I run the output file through the same Java program it finds zero length or blank lines inserted intermittently through the output.

I thought that I could modify my FF schema by asking for a FormatService to be run for each field. Perhaps if I invoked pub.string:trim for each field I’d be able to eliminate the problem.

But when I opened my FF schema that “Format Service” field appears to be inert. I can’t add a service for love or money.

These will be a problem for apps that consume them. What could I have inserted into my FF schema to cause these to appear? How can I get rid of them? Why can’t I add a formatting service to my FF schema fields? Thanks - MOD

Michael,

I believe you have created a FormatService (this service input should be (WmFlatFile)wm.flatfile:FormatService Specification record which has params like value,validate,select convertToString option and so add a map steps and map the value to pub.string:trim (inString) and map the out to FormattedValue.

So in the FFSchema for each field under the properties tab you will see in the right hand corner FormatService (there you browse for the FormatService which it will only allow when the service input (FormatService specification).

If still not clear Search in this site “Format Service” keyword,discussions done on using of FF formatservice stuff.

HTH,
RMG.

Okay, I found out that adding a format service has to be done while setting up the FF schema. No changing your mind after the fact! Plus it has to be a pre-defined service that uses pub.flatFile:FormatService for its Specification Template.

I’ve created a TrimFormatService that uses pub.string:trim to remove leading and trailing whitespace. I’m going to redo my FF schema so every field uses this format service and hope that this gets rid of those intermittent blank lines. I’ll post the result here as soon as I have it.

Thanks - %

If still the problems persists then creating a JavaService is the best option to get rid of those blank lines,ofcourse you are master in the Java/C++ related…

goodluck,

Hi RMG,

Yes, I’ve figured out the steps for creating the FormatService.

I don’t understand why I can’t add it to the FF schema I’ve created after the fact. If I create a new FF schema and add the record in I can associate the FormatService to the field.

Why can’t I add it to the existing schemas? Why must I start again and redefine them? Is there something that I’ve missed? Hearing it now will save me a LOT of work and time. Thanks - %

Michael,

yes you can add the FormatService in the existing schema,i done this.
but i am not sure where you might be missing.

IS it not allowing you to browse which is in the FormatService tab?

But if you are referencing the Schema from a Dictionary,then you have to set the formatservice in the dictionary itself.

HTH,
RMG

Hi RMG,

I’ve got a flat file schema, in which I have defined the file structure. That’s where I see “Format Service” at the rightmost text box with a folder symbol in it.

If I click on the folder symbol, I expect to have a pop-up prompt me for the service I’d like to add. That’s what happens when I’m defining a new flat file schema from scratch.

But if I go into a flat file schema that I’ve already completed and from which I’ve generated a document definition, I can click on the “format service” folder but no pop-up prompt appears.

What did I miss?

%

Hi RMG,

Wait! That’s it! I need to put it in the dictionary that the schema refers to, not the schema itself. THAT’S what I missed!

Thank you so much!

Sincerely, MOD

NOW I’m frustrated.

I went back into my custom FF schema dictionary and added a format service to each field. I asked wM to apply pub.string:trim to each field to make sure there were no leading or trailing whitespace.

When I reran my transformation service I got an error dialog with the message:

java.lang.RuntimeException: [ISC.0049.9027] Error at pub.string:trim - Transformers cannot loop over list elements

I just asked wM to apply a trim operation to a field string value. Isn’t the fact that this might be a repeated element immaterial? I thought the format service would be applied to each field in turn.

Anything obvious that I’ve missed here? Thanks - MOD

Looks like it’s not possible to apply these format services at the field level in the FF schema. wM seems to be telling me that I have to go into the 850-to-FF mapping and apply these trim operations in the mapping. That way the index of a particular repeated element can be made explicit.

I was hoping to skate by and avoid that hassle, but wM is telling me that it’s necessary. sigh

MOD

Might have been due to a trim operation that I added to the 850-to-FF mapping without a proper index value. Stay tuned.

%

Michael,

Trick is inside the formatservice instead of using trim service as a transformer in a map step,just directly invoke the service then you wont see the error(Transformers cannot loop over list elements)

yes also please check in the mapping whether you missed to set the index for that transformer.

HTH,
RMG

Hi RMG,

That’s exactly what I’m doing - I created a TrimFormatService that used the pub.flatFile:FormatService as its specification reference and then inserted a Map step that transformed from the value to the formatted value using the pub.string:trim Java service. Does this sound correct to you?

Right, I had added a trim operation into my mapping and left off the index by mistake. I found it after I had removed all the format services from my FF dictionary. When I still got the error, I realized what the real root cause was. I’ve since removed the offending trim op and put back the format services. The first two test cases have run beautifully.

Thanks again for your patience and help. I wouldn’t have seen that bit about putting the format service into the dictionary without you. Sincerely, MOD

Great,Glad it worked.