I'm trying to programatically remove a proof seed from a delivery.
I can remove the FCPseed from the delivery XML but since the FCPSeeds are not in a node of itself but directly as array under delivery node the write function doesn't remove anything. It only updates or adds.
How can I remove an FCPSeed programmatically?
Example of the code I have that does not work:
function removeProofSeedFromDelivery(proofSeedId, deliveryId){
var deliveryObject = nms.delivery.load(deliveryId); //Load delivery
var delivery = deliveryObject.toXML(); // Convert object to XML to manipulate with JXON
delivery.@xtkschema = "nms:delivery"; //Add the schema, needed for xtk.session.Write
delivery.@_operation = "update"; //Add operation, needed for xtk.session.Write
//Iterate FCPSeeds in delivery and delete matching node
var i = 0;
for each(fcp in delivery.FCPSeed){
if(fcp.@id == proofSeedId){
delete delivery.FCPSeed[i];
break;
}
i++
}
NLWS.xtkSession.Write( delivery ); //Save changes to delivery
}
Solved! Go to Solution.
Views
Replies
Total Likes
Thanks Manoj,
delivery.FCPSeed.removeAll() works for removing all Seeds.
I'm going to try to:
1. load delivery
2. save existing seeds in a variable
3. remove all seeds - with FCPSeed.removeAll()
4. save delivery
5. reload delivery
6. re-add existing seeds (except for the one I wanted removed).
7. save delivery
Would wish there was a way to remove just one. But this will be ok as a workaround.
hello @PLundmark
You can remove the proofs and seeds like this.
// Load the delivery data var delivery=nms.delivery.load(DELIVERY_ID); //remove proofs from substitution delivery.fcpParameters.substitution.removeAll(); //remove seeds from the dynamic conditions delivery.output.seedList.where.condition.removeAll(); //save the delivery delivery.save();
Thanks Manoj,
delivery.FCPSeed.removeAll() works for removing all Seeds.
I'm going to try to:
1. load delivery
2. save existing seeds in a variable
3. remove all seeds - with FCPSeed.removeAll()
4. save delivery
5. reload delivery
6. re-add existing seeds (except for the one I wanted removed).
7. save delivery
Would wish there was a way to remove just one. But this will be ok as a workaround.