Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Problem with containers
System
I am adding containers to my Datacapture Forms and as a result of doing so I am unable to view the original data unless I have two copies of the fields. One in the container and one outside the container.
My problem is really this, I want to be able to display the existing data in the new fields in the container. Any suggestions?
I have included the section with and without the container.
<item name="fileData">
<label>Attachment</label>
<replicant min="1" max="25">
<item name="fileName">
<label>File Name</label>
<database data-type="VARCHAR(255)" />
<description>Choose a file then click "Get file data" to populate the "File Size" and "File Type" fields</description>
<browser initial-dir="/attachments/sales_info/" size="25">
<cgi-callout url="/iw-bin/custom/production/multifilesize.ipl" label="Get file data" window-features="width=1,height=1" />
</browser>
</item>
<item name="fileSize">
<label>File Size</label>
<database data-type="VARCHAR(25)" />
<description>Click "Get file data" to fill this field</description>
<text required="f" size="8">
</text>
</item>
<item name="fileType">
<label>File Type</label>
<database data-type="VARCHAR(50)" />
<description>Click "Get file data" to fill this field</description>
<text size="4" required="f">
</text>
</item>
<item name="downloadTime">
<label>Download Time</label>
<description>Click "Get file data" to fill this field. Show download time for a 28.8k speed modem</description>
<text size="16" required="f">
</text>
</item>
<item name="fileDesc">
<label>File Description</label>
<database data-type="text" />
<description>Enter a description of the file</description>
<textarea required="f" rows="3" cols="40" />
</item>
</replicant>
</item>
<container combination="and" hide-name="t" name="attachments">
<item name="fileData">
<label>Attachment</label>
<replicant min="1" max="25">
<item name="fileName">
<label>File Name</label>
<database data-type="VARCHAR(255)" />
<description>Choose a file then click "Get file data" to populate the "File Size" and "File Type" fields</description>
<browser initial-dir="/attachments/sales_info/" size="25">
<cgi-callout url="/iw-bin/custom/production/multifilesize.ipl" label="Get file data" window-features="width=1,height=1" />
</browser>
</item>
<item name="fileSize">
<label>File Size</label>
<database data-type="VARCHAR(25)" />
<description>Click "Get file data" to fill this field</description>
<text required="f" size="8">
</text>
</item>
<item name="fileType">
<label>File Type</label>
<database data-type="VARCHAR(50)" />
<description>Click "Get file data" to fill this field</description>
<text size="4" required="f">
</text>
</item>
<item name="downloadTime">
<label>Download Time</label>
<description>Click "Get file data" to fill this field. Show download time for a 28.8k speed modem</description>
<text size="16" required="f">
</text>
</item>
<item name="fileDesc">
<label>File Description</label>
<database data-type="text" />
<description>Enter a description of the file</description>
<textarea required="f" rows="3" cols="40" />
</item>
</replicant>
</item>
</container>
Find more posts tagged with
Comments
jbonifaci
Well, since you're essentially changing where to look for the data in the dcr, you need to modify all of your existing dcrs to reflect your new container.
so if your current dcrs have something like:
<item name='fileData'><value><item name='fileName'><value>somevalue</value></item><item name='fileSize'><value>somevalue</value></item><item name='fileType'><value>somevalue</value></item><item name='downloadTime'><value>somevalue</value></item><item name='fileDesc'><value>somevalue</value></item></value><value><item name='fileName'><value>somevalue</value></item><item name='fileSize'><value>somevalue</value></item><item name='fileType'><value>somevalue</value></item><item name='downloadTime'><value>somevalue</value></item><item name='fileDesc'><value>somevalue</value></item></value></item>
you would need to insert <item name='attachments'><value> before the info that is supposed to be in the container and </value></item> after the info that is supposed to be in the container. So the above would now be:
<item name='attachments'><value><item name='fileData'><value><item name='fileName'><value>somevalue</value></item><item name='fileSize'><value>somevalue</value></item><item name='fileType'><value>somevalue</value></item><item name='downloadTime'><value>somevalue</value></item><item name='fileDesc'><value>somevalue</value></item></value><value><item name='fileName'><value>somevalue</value></item><item name='fileSize'><value>somevalue</value></item><item name='fileType'><value>somevalue</value></item><item name='downloadTime'><value>somevalue</value></item><item name='fileDesc'><value>somevalue</value></item></value></item></value></item>
Hope this helps,
Jeff Bonifaci
Charges.docx
Migrateduser
Any ideas on how to do this with some code, either in the form or outside of it? Or, even to get the value of the replicant using perl or javascript. The only reason I'm switching to containers is that I can't get the values of the replicants with the FormAPI unless it's surrounded by a container. If I can get those values without using containers then my problem would be solved.
Adam Stoller
Write a script (perl recommended, but not required) to parse the existing DCR, change the structure of the XML to conform to the new structure of the DCT, and write it out again (and re-set the extended attributes on the output file).
I'd suggest looking at using something like TeamSite::XMLnode for dealing with the parsing/modification.
Test thoroughly before running on all your DCRs
If you're not comfortable writing such scripts yourself, enlist someone who is.
--fish
(Interwoven Senior Technical Consultant)
jbonifaci
Well, the fact that IWDatacapture.getItem() returns null when being used on a replicant that is not in a container is definitely a bug that should be reported and fixed.
But here's a workaround that won't require you to change your DCT and modify all of your DCRs. Use the following javascript to iterate through your replicant, it should work:
var parent = "/Replicant";
var count = 0;
while (IWDatacapture.getItem(parent + "[" + (count+1) + "]") != null)
{
count++;
}
if ( count > 0 )
{
for( var i = 1 ; i <= count ; i++ )
{
// do what you want with IWDatacapture.getItem( parent + "[" + i + "]/ReplicantItem" );
}
}
Hope this helps,
Jeff
JonathonG
Alternately, create an xslt to move the data and an XSLT engine (such as xalan) to conver the DCRs. I did this at one client and it worked great.
Jonathon
Interwoven Architecture Consultant