cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for help with doc_flatten

kmccook
1-Newbie

Looking for help with doc_flatten

------_=_NextPart_002_01C6E257.8821CBA9
7 REPLIES 7
lhales
1-Newbie
(To:kmccook)

Kristina,

What does the custom menu command string look like? The function looks
okay only there is no call to the function. Somewhere we need to call the
function once it is sourced.

So make sure the function is sourced at some point (you can do that in the
menu) and that the function is then started. Depending how you go about
doing this, you will need to have this string somewhere in the sourced
file or menu command

saveXML ()

If you source the function from the menu, then the string should be the
last line in the function, appearing after the last curly brace. If you
source the function during startup or in the instance.acl, then you can
have the call be the command in the menu.

I'd take the function, save it, source it from the command line and then
try doing the 'saveXML()' from the command line and see what happens.

Lynn

Thanks, Lynn. I forwarded your email to him. I already told him that
doc_flatten was a command, not a function, but doesn't the function
entity_expand do the same thing?

In addition to what Lynn said, I'd consider removing the optional "doc"
identifier passed in via the current_doc() function.

Unless you have experience to the contrary, this extra code doesn't appear
necessary since the current doc is the default for doc_flatten.

Less is more,
J





"McCook, Kristina" <->
09/27/2006 11:07 AM
Please respond to
<adepters@arbortext.com>


To
"arbortext-adepters" <adepters@maillist.arbortext.com>
cc

Subject
lhales
1-Newbie
(To:kmccook)

Kristina,

Epic has two doc_flatten features. One is an alias command (help 1201)
and the other (the one your comrade in arms is using) is a function (help
7789).

Lynn

I'm replying on behalf of my teammate. He wants the entities removed,
not just written out.

"...the function is getting loaded correctly as debug (response
commands) are doing the correct thing. The save-as and doc_close also
work."

The problem is the first argument to doc_flatten. You have used a
variable name file rather than a literal and since you haven't declared
file to be 'file', it represents a null string and that causes the
function to fail. Change it to doc_flatten('file', 1, current_doc()) and
it will work. When you try your code from the command line it works
because the command line is a special interpreter window that requires
the $ on variable names.

From a best practices point of view, I would also recommend that you
pass the document identifier to the function with a default value of
current_doc() so that you can use it in different contexts. Try this:

function saveXML(doc=current_doc()) {
doc_flatten('file', 1, doc);
save_as;
doc_close(doc);
}

Steve

McCook, Kristina wrote:
> Can anyone on this list help my team member with this?
>
lhales
1-Newbie
(To:kmccook)

Well, he's right, the file flatten function works, from the command line,
but the saveXML() function does not. It saves the file with the entity
still in the file. I changed the code from save_as to save, no change.
Command line works. I even tried changing the 'file' parameter to 'all'
and that didn't do anything either. I'd contact Tech support, sounds like
a bug to me.

Lynn
Announcements