ellenmeserow wrote:What am I doing wrong? The below does not create a new record specific to the tab the user is on, though I can't see why... It seems to just create a record on Tab 5 mostly. HELP?! I've been banging my head against a wall trying to learn this... Everything so far has made sense (coming from FileMaker), once I figured it out, but this one doesn't seem to have examples in the manuals or CRM solution...
ellen
- Code: Select all
var x = forms.Primary.elements.tabs_70.tabIndex
if (x = 5)
{
forms.TabNotes.controller.newRecord()
forms.TabNotes.contact_id=forms.Primary.contact_id
}
else if (x = 4)
{
forms.TabContHistory.controller.newRecord()
forms.TabContHistory.contact_id=forms.Primary.contact_id
}
else if (x = 3)
{
forms.TabVolHistory.controller.newRecord()
forms.TabVolHistory.contact_id=forms.Primary.contact_id;
}
else if (x = 2)
{
forms.TabVoteHistory.controller.newRecord()
forms.TabVoteHistory.contact_id=forms.Primary.contact_id;
}
else
{
forms.Primary.controller.newRecord()
};
Ellen,
When you declare a variable in a method, you should use an
assignment operator such as "=" - which you do in your method.
However, in your "if" statement you should use a comparison operator -
in your example, this would be a "double equal sign" ==.
If you select the link for "documentation" on the Developer page, you will
see a pdf document that you can download called Servoy Advanced
Programming Guide for FileMaker Developers.
This document can also be purchased as a printed book from the Servoy
store. On page 168 of the printed book, there is a list of comparison
operators that can be used in a Servoy method. On the following page,
page 169, there is an "if" statement example that includes the ==
operator.
If you are not familiar with this document, the Servoy Advanced
Programming Guide for FileMaker Developers includes a SQL primer; a
basic primer on JavaScript; detailed descriptions and examples of the
comparable Servoy function(s) for every FileMaker scripting and
calculation function through FileMaker 6; and other useful reference information.
To register as a Servoy developer, go to
http://www.servoy.com and
click the 4th Hot Topic from the top of the page - "To register as a
developer..." - in the left pane.
______________
Marc Norman
Servoy