DocList and FlatFiles

Hi, I’m extremely new to this, so pardon my ignorance.

I am trying to write a generic method that will

LOOP

  • convert a string to a document using ConvertToValues w/SchemA
  • store document into documentList

Create one big document from all the individual documents
Add a header and footer
Flatten back to flat file with SchemaB


PROBLEM #1
So far, I can convert the inbound String fine - but must create an output of a SPECIFIC schema type in order to access any of the data. I can’t seem to find a way to LOOP through the segments (I want this utility to work for many document types) and say - find the last one and get the record count.

Is there a way to manipulate iDocs without having to essentially CAST them into the specific schema?

PROBLEM #2
Inside the loop - I am using pub.list.appendToDocumentList to add each individual document to the documentList. However, it’s OVERWRITING each time.

According to the dev manual, this is because it copies by REFERENCE. It suggests immediately dropping the input variable, forcing a new instance each time it’s called. I’ve implicitly done this and it is STILL overwriting the method.

The other option is to copy each indivicual set of records over implicitly - which would
make the method NON generic.

PROBLEM #3
There doesn’t appear to be any way to create a flat file document referencing other DOCUMENTS ( only records/elements and their references). This appears to mean I need to flatten each document in the array (List) individually to a string, then concatenate the header/footer to it. Is this correct?

Any ideas? I"m really stuck and this was supposed to be completed TODAY!!!

Thanks.

Problem 2 :- when u use pub.list.appendToDocumentList , u need to drop the document at the place where u map the doc to input of pub.list.appendToDocumentList .that should take care of your problem.

Problem 3 :-
i didnt get what the problem really is here?