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)
ID Generation for Replicant fields in Data Deploy
krishna_kumar
Hi
We have a requirement where we need to deploy DCR content into tables using datadeploy. All the tables we are using have a column (ID ) which is a primary key column and is a running number.
We are able to generate ID in a simple scenario where there are no replicants in a group using External Data Source and also using tuple and setting it to any hidden item in DCR (which we do not want to follow the approach). But the problem arises when we have to deploy fields which have replicants and ID has to be generated for each replicant column. IWExternalDataSource does not support if we have replicants. Drained of ideas, any suggestion is highly appreciable. Thanks in advance.
Find more posts tagged with
Comments
vpatel
Few ways to handle this:
- Generate 1 ID per DCR and then slap on another number for each DCR. Say DCR101 is your ID, then your replicant IDs would look like this: DCR101-1, DCR101-2, DCR101-3...FormAPI should be able to do this for you. Only thing you'll have to do is that when you add new replicants, just make sure you dont take an ID that already exists.
- Alternatively you do something using the replicant number itself as an option on the DD mapping side...
ACheethayil
Create a hidden field called rep_count within the replicant.
Frame
Headline Text:
and set the values in ascending order. You can use a JS function as follows. it can be used as a common function.
function setRepCount(strReplicant)
{
var numReplicantCount = getReplicantSize(strReplicant);
for (var counterReplicant=0; counterReplicant {
var repnodecount = counterReplicant + 1;
IWDatacapture.getItem(strReplicant + "[" + repnodecount + "]/rep_count").setValue(repnodecount);
}
}
function getReplicantSize(strReplicantName)
{
var RepSizeCounter;
for (RepSizeCounter=1; RepSizeCounter!=1.1; RepSizeCounter++)
{ //Infinite loop
var item = IWDatacapture.getItem(strReplicantName + "[" + RepSizeCounter + "]");
if (item == null)
{
break;
}
}
//Convert from 1 to 0 base
RepSizeCounter = RepSizeCounter-1;
return RepSizeCounter;
}