I have a subform that contains a field named Service_Location. I want the value to default to 1, and increment by 1 each time I add a new instance of the subform using Designer ES-4. I am a newbie to Designer, and do not "speak" Java.
Suggestions?
Views
Replies
Total Likes
Hi Anokie1,
In your field Service_Location, go into the Object->Value tab, next to Default: write 1.
Then after your code that adds new instance, write this :
Service_Location.rawValue = Service_Location.rawValue + 1 (make sure formcalc is selected as the language)
If you want to make sure your have the right cell, when you are in the event editor, you can hold ctrl and click on your Service_Location cell, this way you make sure there will be no mistake. After clicking on it, the complete path will be written you simply have to add .rawValue and the rest of the instruction.
MTremblay-Savard,
Thank you for your response. I just have two questions.
When you said, "
Then after your code that adds new instance, write this :Service_Location.rawValue = Service_Location.rawValue + 1 (make sure formcalc is selected as the language),"
I used the Action Builder tool to create all this. I don't know where in the code to insert your statement.
Michael
Views
Replies
Total Likes
1st : You can open the script editor palette by going in the top menu, clicking on Palettes -> Script Editor (CTRL + SHIFT + F5), when the script editor is opened, on the top right, you have a language dropdown menu, select Formcalc.
2nd : You don't need to look at the XML source code.
Can you please clarify your problem? Do you want to count it at runtime or as you create it in the designer?
Max
I wish the counter to increment when the "Add Service Location" is clicked by the user during runtime.
I have captured the portion of my screen that I believe is the Script Editor. When I click on the button, there are several lines showing. They all contain the name of my object, followed by two colons ( :: ). These are followed by words such as
I tried to insert your statement as shown, but I get an error message.
Suggestions?
Views
Replies
Total Likes
The words you listed there are the moments where your code can be triggered, you have to choose the one that apply to your problem. Personally, i'd say you would have to put your code in the click event.
Can you send the error message you're receiving please?
Max
Views
Replies
Total Likes
Here is a screen print of the error message.
Here is a screen print of the code in the script editor.
Views
Replies
Total Likes
in formcalc, there is no { } and ;
The correct syntax would be
if (xfa.host.version < 8 ) then
Service_Location.rawValue = Service_Location.rawValue + 1
endif
Views
Replies
Total Likes
Code and error message follows.
What am I missing?
Views
Replies
Total Likes
When I use Action Builder to create a new instance of Service_Locations, it creates the following Java script and comments out the script you provided. The script adds a new instance above the first instance. I want it to be added below.
//+ GENERATED - DO NOT EDIT (ID:22CE6DFD-DD76-4749-8B34-C8D33B321304 CRC:507825259)
//+ Type: Action
//+ Result2: AddInstance("$Node3")
//+ Result1: SetFieldValue("$Node2","tovalue","Alternate")
//+ Node3: topmostSubform[0].Service_Locations[0]
//+ Node2: topmostSubform[0].Service_Locations[0].Service_Location[0].Service_Location_Header[0].Service_Address_Type[0]
//+ Node1: topmostSubform[0].Service_Locations[0].ActionButton[0].Add_Service_Location[0]
//+ Condition1: Button("$Node1","click")
//+ ActionName: Add_Service_Location.click
if (xfa.host.version < 8) {
xfa.form.recalculate(1);
}
//-
/*
if (xfa.host.version < 8) then
Service_Location.rawValue = Service_Location.rawValue + 1
endif
xfa.form.recalculate(1);
*/
I still cannot get the counter to increment.
Views
Replies
Total Likes
You have the syntax slightly wrong. In formcalc the instance manager should be:
nameOfTheThingYouAreAdding.instanceManager.addInstance()
You don't need all the action builder stuff.
MTremblay-Savard is correct on the count.
Views
Replies
Total Likes
As Whyisthisme said, the problem is not on the lines i gave to you, the problem is your "this.resolveNode('topmostSubform._Service_Locations').addInstance(1);"
First, as i said there is no ; in Formcalc, so remove it. Second if you want to add an instance, do as whyisthisme said :
nameOfTheThingYouAreAdding.instanceManager.addInstance()
This should be working.
Max
Views
Replies
Total Likes
I have tried to incorporate all of your instructions into the following code.
However, I get the following error message. There is not a new instance and the counter does not increment.
I truly appreciate your assistance and patience.
Anokie1
Views
Replies
Total Likes
There is something you are messing up.
1. The thing you want to make a new instance of and the counter should not be the same item. The counter should be an other object that only increments and that is hidden so it does not appear on your form.
2. You messed up writing the syntax, you've writen instanceManger instead of InstanceManager. In fact, not every objects have an instance manager, if you want to make sure yours have one, when you write the name of your object and the '.'(dot), you get a list of items you can choose from, if instanceManager is not in it, your object does not have an instance manager. From what i know so far, i know that text object doesn't have an instance manager, instead you should use text fields.
Max
Views
Replies
Total Likes
I have instanceManager working now. I caught the spelling mistake.
Here is a screenprint of the heirarchy tab of my form.
The Service_Locations subform occupies an entire page. When I click on the "Add_Service_Location" button, I need three events to occur.
Is this possible?
Anokie1
Views
Replies
Total Likes
Hi Anokie1,
1. Does the creation of the new instance of your page work? And i don't think you can "push" the "Add_ServiceLocation" button to the next page. You should check some information about the instance manager, it might clarify some things for you.
2. The incrementation should be working by now, doesn't it?
3. This is mostly like the incrementation, but instead you write :
Service_Locations.Service_Location.Service_Location_Header.Service_Address_Type.rawValue = "Secondary"
Max
Views
Replies
Total Likes
We are getting extremely close.
Here is the script for your review.
Thanx.
Anokie1
Views
Replies
Total Likes
2. Hmm, what if we put the counter on the master page?
3. Check the documentation if there is a way to set values of certain instance of an object. example : yourthing.instance(2).rawValue = "Secondary". Something like that.
Max
Views
Replies
Total Likes
Views
Replies
Total Likes
Can you jump into this problem again? I thought we were getting close.
Views
Replies
Total Likes
Hahahahahaha nice one, i agree there is a huge lack of documentation. Here is this documentation about the master page.
http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=000076.html
Do you have a vague idea of what a master page is? In gross, a masterpage is a page that contains the information that repeats over the pages, like the header or the footer. You can have multiple master pages if you want only your first page to look like something and the others like something else. In the master pages, you have something called a Content Area, this is where your Page will appear. If you want to create a master page, above your Service_Locations in your hierarchy, you should have something called (Master Pages), right click on it and click on add new master page. Do some tests on it and you'll get used to it. It might(and probably will) even be useful for what you are actually doing.
This seems to be talking about changing the value of certain instance of your object. Take some time and try to understand it.
Max
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies