Print multiple copies - Variable Data not printing

JFrazee

JFrazee

Member
I have a Bill of Lading that I need to have 4 copies of, each with a different header. I can get the 4 copies with different headers by putting the entire report in a for-each loop. My problem is that none of my xml fields show data from my XML file after I put the for each loop on. I only get the static text and form lines. I also tried using a variable like this...
<?variable@incontex:x;4?>
<?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,$x,1)?>
and I also tried putting "$x/" in front of my XML fields.
I'm kind of lost...please help.
Thanks!!
confused.gif
 
Try something like this:

<?variable:x;4?>
<?for-each@section:Order_Header_S13?>
<?variable@incontext:currentorder;.?>
<?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,$x,1)?>

The trick is storing the current node in a variable. So then you can refer to the header fields by prefixing with $currentorder/.

If you need to loop over the lines, then use:

<?for-each:$currentorder//Order_Line_S15?>

The double slash is important because of the way that JDE structures the XML.

Dave
 
Hey Dave, Thanks for the reply!!
so now I have this....

<?for-each@section:On_Address_Number___Header_S5?>
<?variable@incontex:x;4?>
<?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,$x,1)?>
<?for-each:$x//On_2nd_Item_Number_S8?>

I get an error saying ....
"Cannot convert number to NodeSet."

Thanks
Jasper
 
Hey Dave,
I got it to half way work.
I'm not getting any errors anymore!
I'm getting the detailed data, but the fields in my header and footer are not showing up. I put "$CurrentAddress/" in front of the fields in the header, but still nothing.
Here is my code that now works for the detail data..

<?Call:Header?>
<?variable:x;4?>
<?for-each@section:On_Address_Number___Header_S5?>
<?variable@incontex:CurrentAddress;.?>
<?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,$x,1)?>
<?for-each:$CurrentAddress//On_2nd_Item_Number_S8?>

Thanks
Jasper
 
Hi Jasper

Add a 't' to 'incontex' on the CurrentAddress variable declaration:

<?variable@incontext:CurrentAddress;.?>

Also, I presume that the <?Call:Header?> statement is defined within the Word header...is that right?

Dave
 
Hey Dave,
Yep, the header call is in the header section of the word doc.
Good catch on the missing 't' !
I still don't get any fields to pull through in the header section. If I put "$CurrentAddress/" in front of the field, I get a "Variable not defined: CurrentAddress" error.
Thanks For The Help!
Jasper
 
Oh, don't you just love BI Publisher. I wish someone would explain to me how contexts work.
smile.gif


If you had all your header fields in the Word header (ie: weren't use a template), then this would work fine. However, because you're using a template, then the template can't see the $CurrentAddress variable for some reason.

So try the following:

Define your template with a parameter, eg:

<font color="blue"><?template:Header?><?param:pCurrentAddress;string('')?></font>

And then use $pCurrentAddress instead of $CurrentAddress in the header fields. Note that that's two single quotes in parentheses.

And in the Word header, call the template as follows:

<font color="blue"><?call@inlines:Header?><?with-param:pCurrentAddress;$CurrentAddress?><?end call?></font>

Don't forget the @inlines in the call statement.

Best of luck!
Dave
 
Hey Dave,
Sill nothing.
here is what I have..

In header of word doc i have....
<?Call@inlines:Header?> <?with-param:pCurrentAddress;$CurrentAddress?><?end call?>

In body of word doc I have ....
<?template:Header?> <?param:pCurrentAddress;string(‘’)?>
<?end Header?>

<?variable:x;4?>
<?for-each@section:On_Address_Number___Header_S5?>
<?variable@incontext:CurrentAddress;.?>
<?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,$x,1)?>
<?for-each:$CurrentAddress//On_2nd_Item_Number_S8?>
 
I don't know if it'll make a difference, but try <?end template?> instead of <?end Header?>.
 
HEY!
I went back though my loops and fields and I had one for-each loop referencing the wrong group in my XML Data.
So passing the parameter through the header worked!!
Thanks for all your GREAT GREAT help!
Jasper
 
Back
Top