on 11-14-2006 6:18 PM
Hello again
I'm having some trouble again (tricky to work with this Interactive Forms...)
I'm adding a new table to my pdf that must have 2 "normal" columns, that are mapped to respective fields on webdynpro table node context; and then other 3 columns that will show (or not) a small image (an icon).
I allready added an imagefield for each column, but in the manual they say that binding here should be "none". So, how can i say that i want to read attribute A of my table row (node attribute), that must have values "X.gif", "Y.gif" or "X.gif", and then print in the pdf the respective image ?
thanks,
Nuno
Hello Nuno,
I have solved this problem with a Imagefield and the following FormCalc-Script:
for int=0 upto $record.anz_list step 1 do
Data[int].ImageField1.value.#image.href = $record.List[int].image
endfor
List.image includes the url of the image and anz_list includes the row-quantity of the table.
Albert
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Albert,
Is the line
this.value.image.href = xfa.resolveNode(this.value.image.href).value;
in the initialize event still necessary ?
And what is "Data" ? The name of the subform ?
Where shall i put that script ? in the initialize? calculate event ?
thank you
Nuno
Message was edited by:
Nuno Santos
hi Nuno,
With regard to your problem regarding images being displayed in table rows, basically we code for displaying the image in Interactive form like this.
sample code
<i>//String url = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getDeployableObjectPart(),"LHP.jpg");
//wdContext.currentZ_Ff_Ar_Invoice_Copy_InputElement().setInvoiceUrl(url);</i>
Here the <b>InvoiceUrl</b> is the <i>value attribute</i> and in the Inteerractrive form designing for that particular Image field we set the URL as $record.InvoiceUrl under Field Tab and the Default Binding should be None as you are binding the imagefield thru a value attribute in our case InvoiceUrl.
Hope this clears your problem.
Thanks,
kris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Kris,
Thank you for your reply. But i'm still having a problem. I don't know why, the script window of my image field appears disabled. I say this because i also think i need to add the line:
this.value.image.href = xfa.resolveNode(this.value.image.href).value;
on the initialize event of the image field. This is how i'm doing things in another imagefield i have on my form, but only with one of two images being displayed, and out of any kind of Flow content subform, ie out of any table.
Other question: I have a node Competences->CompetencesC->ND, being "ND" the value attribute of the node CompetencesC (that will have more than one row) inside node Competences ( "root" node of cardinality one).
So, i think i have to put this on the URL field:
$record.Competences.CompetencesC.ND
But is this enough to specify that i want image of index 0 in row 0, and image of index 1 in row 1 (that most surely will be different) ?
Message was edited by:
Nuno Santos
hi Nuno,
You need to put the line in the script window:
this.value.image.href = xfa.resolveNode(this.value.image.href).value;
Regarding your Other question:
You need to put this on the URL field:
$record.ND as ND is your value attribute. and as you said u have three columns which display images in the table, then I suppose you need to take three value attribute in that case.
PLease let me know further help u require.
Thanks,
kris
Hello again Kris,
I tried your advice but still doesn´t work. I'm goint to show you a list of what i'm doing:
- I added an Image Field into the subform of FlowContent and Table Row direction.
- Default Binding of Image Field is None.
- Field URL is $record.Competences.CompetencesC.ND
(i allready tried only with $record.ND or $record.Competences.ND .... but still doesn't work)
- The Attribute ND of node CompetencesC (included in node competences) is feeded in the java source like this:
IPrivateExportPDFView.ICompetencesCElement compC =
wdContext.createCompetencesCElement();
compC.setNAME_CLUSTER("Group A");
compC.setNAME_COMP("Management");
try {
String url = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getDeployableObjectPart(),"Laranja.jpg");
compC.setND(url);
} catch (WDURLException e) {
wdComponentAPI.getMessageManager().reportException(e.getMessage(), true);
}
compC.setA("");
compC.setB("");
wdContext.nodeCompetenciasC().addElement(compC);
I'm still not using the other two columns A and B wich we'll also have image fields, one for each respectively.
- Layout Caption Position = None
- In the Script, Initialize Event, i added the phrase:
this.value.image.href = xfa.resolveNode(this.value.image.href).value;
Am i missing something ??
Thank you,
Nuno
Hello Nuno,
If the script runs in a table cell, you can use the index of the surrounding table (<b>this.parent.index</b>). I guess that "Competences" is the recurring element in your example, thus please try to change your coding as follows:
this.value.#image.href = xfa.resolveNode("xfa.record.Competences[" + this.parent.index + "].CompetencesC.ND").value
Regards,
Philipp
hi Nuno,
Please try out this:
Sample code:
Access with an index number. When using xfa.resolveNode,the search
starts at the top of the form hierarchy and moves down.
var nIndex = 2;
var sSOM = "Subform2[" + nIndex + "]";
var oSubform = xfa.resolveNode(sSOM);
oSubform.NumericField4.rawValue = "25";
Thanks,
kris
Hello Philipp,
In What event should i put your code ? I allready tried in initialize and calculate, but doesn't work.
Also, the recurrent node is CompetencesC, so i entered like this (JAVASCRIPT):
this.value.#image.href = xfa.resolveNode("xfa.record.Competences.CompetencesC[" + this.parent.index + "].ND").value
Also, i still have in my URL field of the ImageField:
$record.Competences.CompetencesC.ND
Am i doing anything wrong ?
Message was edited by:
Nuno Santos
Message was edited by:
Nuno Santos
Hello Nuno,
The initialize event should be ok.
Could you please try these steps:
1. Change the image field to a normal text field (binding = none).
2. Enter the following JavaScript to the initialize event of this text field:
this.rawValue = this.parent.index
When you then render the form, you should see increasing numbers in this field (e.g. 0, 1, 2, ...).
3. Change the script to:
this.rawValue = xfa.resolveNode("xfa.record.Competences.CompetencesC[" + this.parent.index + "].ND").value
Now you should see the different image URLs in the form fields after rendering.
What are your results?
Regards,
Philipp
Hello Philipp,
I changed to a Text Field, mapping the index, like you said, and it shows the increasing numbers 0,1,2,... all ok.
Then i added the other line, and i don't get nothing at all !!
I added this code to the webdynpro application:
int size = wdContext.nodeCompetencesC().size();
for (int i = 0; i < size; i++) {
IPrivateExportPDFView.ICompetencesCElement elem =
wdContext.nodeCompetencesC().getCompetencesCElementAt(i);
wdComponentAPI.getMessageManager().reportSuccess("ND: "+elem.getND());
}
and my list of images URL's is printed on screen !!
So, i must be missing something in the process. One question (i tried both, but nevertheless...): the script you're mencioning is Javascript or FormCalc ?
Additional Info: My form data source is node AnualForm, that has a node of cardinality 1..1 Competences, that has a node of multiple cardinality CompetencesC, and a value attribute ND.
CORRECTION: My mistake. It does lists all URL's. I added a node with a different name. Sorry. Now what ? Change to Image Field ?
Message was edited by:
Nuno Santos
Hello Nuno,
Great! So we have proven that the indexing works as well as retrieving the different URLs. Now you should change the field type back to an image field and instead of setting the field's 'raw value' (<b>this.rawValue</b>), the URLs have to be applied to <b>this.value.#image.href</b>.
Regards,
Philipp
Hello Philipp,
I allready did that. Now i have an image field ( binding "none", added nothing to the URL field), and with the following code in the initialize event (JAVASCRIPT):
this.value.#image.href = xfa.resolveNode("xfa.record.Competences.CompetencesC[" + this.parent.index + "].ND").value
I got no images. If you're wondering if i got the url's right, i allready tried this line in initialize:
this.value.image.href = xfa.resolveNode(this.value.image.href).value
And i do got the image refering to the first row repeated through all rows. What i also had in the URL field was the path $record.Competences.CompetencesC.ND.
Could that be the reason ?
Can anyone give a help on this one? i'm really getting out of ideas and seemed to have tried all possibilities in the options of the ImageField. I think that a complete step by step solution would be appreciated not only by me, but also to other colleagues who are now starting the use of interactive forms generated on webdynpro.
Thank you in advance to all who patiently helped me ,
Nuno
Hello Nuno,
I created a small example (standalone, not in web dynpro) that shows three different images in a table and it works fine. When I set the binding of the image field to 'global', it does not work anymore, i.e. I get the same image shown in all rows. So in case your binding is currently set to 'global', please change it to 'none'.
Regards,
Philipp
Thank you for your reply, Philipp. I didn't have the binding on "global", but i allready tried putting it as "none" and "normal", and it still shows the same image in all rows.
Thank you,
Nuno
PS - Anyway, today i will not be near the office, so i can't test anything until tomorrow. I'll check anything tomorrow and will let you now.
Message was edited by:
Nuno Santos
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.