Copy link to clipboard
Copied
We have to do a lot of dictation from our clients, and since 80% is routine questions, I created a dictation form where all you do is add answers and it fills out the bob said x and john said y. Then it takes all the individual questions and dictation and spits out one long document with all the dictation, which makes it look like I wrote the whole thing out. My question is, what is a script I can use so if I don't answer a question it is not added to the main dictation output. looks like something below. Hope it makes sense, I am not a programmer so I borrowed some script and worked with what I know to create this. As of now I have 43 questions and I have to go back and delete out questions that are blank. I want to be able to just copy and paste it, without editing.
My Question:
How old is the client? 25. (the reply typed by user)
Separate form fields I made for scripting:
(q1)Cw asked (who)Bob (q1a)how old (gender)he (q1b)is. (who)Bob (q1c)said (gender)he (q1d)is (q1r)25.
Text box code to bring question and reply all together named (t1):
event.value =
this.getField("q1").value + " " +
this.getField("who").value + " " +
this.getField("q1a").value+ " " +
this.getField("gender").value + " " +
this.getField("q1b").value+ " " +
this.getField("who").value+ " " +
this.getField("q1c").value+ " " +
this.getField("gender").value+ " " +
this.getField("q1d").value+ " " +
this.getField("q1r").value; (the reply from client, the only thing typed by user)
t1 (CW asked Bob how old he is. Bob said he is 25.)
Text box code to bring all sentences together named (final dictation):
this.getField("t1").value + " " +
this.getField("t2").value + " " +
this.getField("t3").value + " " +
*I want something like. If "q1r" is blank then skip t2 and move on to t3.
Copy link to clipboard
Copied
Your description is a bit confusing, but you can achieve what you described like this:
var text = "";
if (this.getField("q1r").valueAsString!="") text+=this.getField("t2").valueAsString + " ";
if (this.getField("q2r").valueAsString!="") text+=this.getField("t3").valueAsString + " ";
// etc.
event.value = text;
Copy link to clipboard
Copied
Your description is a bit confusing, but you can achieve what you described like this:
var text = "";
if (this.getField("q1r").valueAsString!="") text+=this.getField("t2").valueAsString + " ";
if (this.getField("q2r").valueAsString!="") text+=this.getField("t3").valueAsString + " ";
// etc.
event.value = text;
Copy link to clipboard
Copied
Thank you so much. This will save us all so much time, and allow us to meet more people.
Copy link to clipboard
Copied
You should be aware that fields with the same name will share the same value. You might want to be more clear as to what fields go into t1, t2, and t3.
It is possible to build a string from multiple fields and omit a field that has a null or empty string value. Adobe has provided such a function in older versions of the Acrobat distribution CD.