can LiveCycle reference value of a new instance in rum-time

techwriter1234 07-08-2015

I am a novice at LiveCycle Designer and I am needing to have my form reference a specific value, should it be entered (recognizing key words), by a user in an add instance, at run-time. Can LiveCycle even do this? And I can be more specific with an example if this doesn't make sense. If you can help, I'd very much appreciate it!

Mark Solution

Are these answers useful?
Help other community members by marking useful answers as accepted.

Accepted Solutions (0)

Answers (6)

Answers (6)

BR001
MVP
13-08-2015

Hi,

I've updated the sample to produce a summary table of all lines that start with the word "critical", https://sites.google.com/site/livecycledesignercookbooks/home/Multilevel_Step_Numbering_With_Summary...

Have a look under the calculate event of the Summary object.

Hopefully you can apply the code in your form.

Regards

Bruce

techwriter1234 12-08-2015

Hi Bruce,

Thank you for your time and response. I would love to show someone this template ("form") but I can't unfortunately. Its a confidential document within my company. As for the structure of the form, I actually used a template that another Adobe member sent me and expanded on it for my needs. What he sent was  this: https://files.acrobat.com/a/preview/535d7c39-766b-418f-9e2a-3a92f808ab54

It was very helpful in terms of the layout of my template. If you look at this sample business proposal ( http://www.writinghelp-central.com/sample-business-proposal.html‌ ) it is very similar to the template I am creating. Of course the content is subjective because half of my template content will be user input at run-time. At the end of my template, are appendix tables (to be summary tables) in their own subform page. If the user types in the main body, values (in multiple text fields) that contain "Critical", i need all instances containing "Critical...." along with the level number rawValue to be referenced in the summary table so now the table needs to be conditionally expanding as well as referencing objects, AND recognizing specific indexOf "Critical"  . And being I am a beginner in javascript (self taught), I am afraid I am over my head. Any and all help (in novice terms or otherwise) is much appreciated! I apologize for being a beginner and asking for an advanced task. Take care!

BR001
MVP
11-08-2015

Hi,

You should be able to populate the summary table, either in the exit event of Level3 or maybe the calculate event of the summary table, assuming the exit event the code would like something like;

summaryTable.setInstances(0);

var level1Items = ???.resoleNodes("Designerlevel1[*]")
for (var i = 0; i < level1Items.length; i++)
{
var level1Item = level1Items.item(i);
var level2Items = level1Item.resoleNodes("DisplayLang[*]")
for (var j = 0; j < level2Items.length; j++)
{
  var level2Item = level2Items.item(j);
  var level3Items = level2Item.resoleNodes("Level3[*]")
  for (var k = 0; k < level3Items.length; k++)
  {
   var level3Item = level3Items.item(k);
  
   if (level3Item.Label.rawValue.indexOf("Critical") === 0)
   {
    var newRow = summaryTable.addInstances();
    newRow.Number.rawValue = "???"
    newRow.Item.rawValue = "???"
   }
  }
}
}

I don't really understand your form structure, but hopefully that will head you in the right direction.

I'm happy to look at your form but would prefer if you would post a link to it in this thread, then it may be helpful to others and someone else might be able to help.  I probably wont be able to get back to this forum until the weekend.

Regards

Bruce

techwriter1234 10-08-2015

Hi Bruce,

thank you for your reply. I feel I may have to email you more as my terminology and understanding of LiveCycle is new. I have attached screen shots from my form in run-time as well as my hierarchy. My form is really a template for Engineers who will need to fill this out and there will be many cases where the user will need to add additional text fields (add instances) using a click event. Later in the template, I have tables that need to reference the value of text fields within each instance should the value be "critical". However, since the user will be adding instances, I don't know how to reference the value of a new instance at run-time. I can send you more in an email if this doesn't make sense. Thank you for your time and help! I have only taught myself everything with LiveCycle so please be patient if I don't understand conclusions. My apologies in advance. Thanks again!

Capture.JPG

Capture2.JPG

BR001
MVP
08-08-2015

Hi,

I don't understand what you are trying to do, but calling the addInstance() returns the instance of the subform (or row) you have just added.  So if I had a repeating subform called Subform1 which contained a text field called TextField1 then I could set the value of that field with.

var newInstance = _Subform1.addInstance();

newInstance.TextField1.rawValue = "some text";

Given a text field you can test if it contains a string with

 

if (/keyword/.test(Subform1.TextField1.rawValue))

{

    console.println("match");

}

else

{

    console.println("no match");

}

This will print "match" on the console if TextField1 contains the string "keyword" anywhere within it.

What I don't understand is how you want to use these two pieces of code.

Regards

Bruce