I want to the change the value of same tag in a single document at runtime
for example :-
Schedule_1 : A
Schedule_1 : B
Schedule_1 : C
Schedule_1 : D
Discussion posts and replies are publicly visible
Please help me to understand what you want to achieve. What do you mean with "tag" and "document". Please elaborate.
while generating document tags are replaced by the values
In Single document if single tag is placed more than one time then it always replaced with a single value suppose ##Name## placed 4 times in a single document the all the tags replace with the same value .
example:-
##Name## : Richa
my requirement is when i place single tag more than one time in a document then it replace with the different values
##Name## : A
##Name## : B
##Name## : C
Document Template would be static. So it would have a fixed number of ##Names## tag in your case.
Why don't you name them as ##Name1##, ##Name2##, ##Name3##, ##Name4## ?
or anything to make them unique and you can map it as usual.
If you are using dynamic templates within the node, even then the keys should same, and if you are trying to achieve this to code the values easily, you may try to get a list of names and index it to the keys
Eg:
you have your data as say in a pv!docData: {
name: { "Richa S", "R Sharma", "Richa Sharma", "Sharma Richa" }
}
then in your node, you can map the keys as:
Name1: index(pv!docData, "name", 1)
Name2: index(pv!docData, "name", 2)
Name3: index(pv!docData, "name", 3)
Name4: index(pv!docData, "name", 4)
Hope this helps ! Or, can you explain your use case a little more, why do you need same tag to iterate on a list ?
this is what client want
let suppose we have 3 product A) TV, B) PHONE ,C) Washing MACHINE
in document page A) product is not available then i want other product {B) To A) }to auto shift
Perhaps thinking about it a little differently...could you not have ONE tag that will hold ALL of the details formatted as you describe and you can construct that in a rule before passing it to the tag? We do this with emails sometimes, where it's just easier to have the content constructed entirely in a rule, and then dump the entire content to the email. So you could have a tag named ##CONTENT## and this is replace by the formatted value from a single rule that covers everything you need it to contain.
I agree with Stewart here.
It's much easier to have it as ONE tag at least for this part of your document, and prepare this in a rule where you could play around easily with what data to put when one product is not available
i already made rule
a!localVariables(local!data:{"name","name","name"},local!test:count({"name","name","name"}),a!forEach(items:local!data,expression:if(fv!index<=local!test,char(sum(64,fv!index)),char(sum(64,fv!item.[fv!index])))),
)
but while placing tag value in the document how to identify the no of count of that tag in a document
Why do you need to identify the "no of count of that tag in a document"? If you generate the content to include the labels, the values for those labels, and any newlines required between each content item then your tag will simply be replaced wiht the entire formatted content you've generated in your rule.
Hi Stewart Burchell Actually, the scenario is if the customer has used the tags like as following in document which has multiple pages and multiple number of tags have been used throughout the document. Then suppose there are 4 schedule tags in the current scenario,###Schedule_1### should be replaced with the value: Schedule A when it occured first time in the document,The very next time ###Schedule_1### is found, the value should change from Schedule B, and then the next time ###Schedule_1### should be Schedule C in the document.In short, the number of occurences of the tag in the document will dynamically decide the value against the tag that needs to be replaced.Is is possible?
Is there static content between the various tags that you mention? If so I still think you will find this easier to assemble as one piece of content in an Appian rule 9or set of rules) and then have a single generic tag in your document that gets replaced by the content you've dynamically constructed in your code.
The content generation is dynamic and we do not know the sequence/number of tags in a document.
Is your document a plain text one ?
If yes, one way you could achieve this is by reading the data in the document and apply a logic to replace the tags by your replacement values in an expression rule and then create that as a document.
Off course, you should consider this from a performance standpoint depending on the size of your document
Then I would construct the content dynamically within an Appian ruleset, and dump the final output to your Word document through a single tag. You could think of your tag as a placeholder for the entire document you're wanting to generate.
Stewart Burchell said:dump the final output to your Word document through a single tag
This is what I was thinking of as well. I've done it before and once you deal with a few preliminary challenges, the rest is pretty easy to handle, and it opens up the ability to build and parse custom templates (as long as the user creating the template strictly follows whatever replacement logic you dictate).