Please excuse if these are stupid questions. I’ve only been familiar with filemaker and i’m trying to learn servoy/javascript from scratch.
1)How do you do a lookup? I have a field “spec min”, i want it looked up from another table (PARTS). Once the value is looked up, i don’t want that value to change ever again even if the data on the PARTs table changes. I tried dataprovider–> related value, but that updates everytime I update the PARTS database.
2)I have a list layout with a bunch of fields. (wall1, wall2, wall3..etc). Whenever the user exits the field (ondatachange), i want it to perform a script where it checks the value vs a specification limit defined in PARTS table. If it’s greater or less than the specification limits, color the field background red, otherwise, color it green. if blank, make it no color. How do you do that? I’ve search thru the forum and used the element.value.bgcolor=‘ffffff’; but keeps getting a “undefined value has no properties” error. Please help.
1> I think you’ve set a related field in your form instead of a lookup field.
You can set a field to be looked up by going to
-Define dataproviders
-higlight a column
-click on properties
-set auto enter to be a lookup value (based on a relation)
maarten:
1> I think you’ve set a related field in your form instead of a lookup field.
You can set a field to be looked up by going to
-Define dataproviders
-higlight a column
-click on properties
-set auto enter to be a lookup value (based on a relation)
Is that a new function in the latest version? I have version R2 2.1rc4 build 307.
BECAUSE: when i click properties in define dataproviders, when i get to AUTO ENTER, i only see the following options:
jcompagner:
2> you need to name youre elements like ‘wall1textfield’
then do elements.wall1textfield.foreground = ‘ff0000’;
I tried to name my elements. Still doesn’ work. keep in mind i’m in a list view.
my code now is
elements.wall1textfield.bgcolor=‘fffff’; and it doesn’t work. it’ll change the entire column. I just want that invidivual record to change
create an unstored calc field
calulation looks like :
if(.......)
{
return '<table height="20" width="100" bgcolor="red"><tr><td> </td></tr></table>';
// height and width match the size of the actual field in your form
}
else
{
return "";
}
place a label in your listview
attach the calculationfield to the textproperty of your label and enable html
set the borders of your label to empty
enable the “display tags” property of your label
slide the label under behind the inputfield
(OR in case you don’t need the inputfield to be editable:
-change your calc into
return ‘
’+myField+‘
’;
-remove the original input field.)
notes:
-sliding a calcField under another field won’t work in tableview
(tableview auto arranges all elements next to each other)
-you can use single or double quotes when coding in Servoy
(In this example I used single qoutes to mark string parts
and double quotes to mark html properties like height and width)
create an unstored calc field
calulation looks like :
if(.......)
{
return ‘
’;
// height and width match the size of the actual field in your form
}
else
{
return “”;
}
2) place a label in your listview
3) attach the calculationfield to the textproperty of your label and enable html
4) set the borders of your label to empty
5) enable the "display tags" property of your label
6) slide the label under behind the inputfield
(OR in case you don't need the inputfield to be editable:
-change your calc into
return '<table height="20" width="100" bgcolor=red><tr><td>'+myField+'</td></tr></table>';
-remove the original input field.)
I must be doing somehting silly and wrong? i can’t get the darn thing to work. No color changes, just a plain white field.
here’s what i did
i went toe data prodvider and make the calculation with the HTML statements listed above. Make the return type to be TEXT
In properties, I did:
2)checked Displays Tags
changed displayType to IMAGE_Media
text: double clicked on the field. ( the text tab has “Use HTML” check) and the shows %%fieldname%%
Also, on a related matter, i need to drop HTML into a field in record view:
I followed step 2-4 after creating a text field in the dataprovider. Nothing shows up.
I don’t get this part.
The unstored calculation part seems ok, but then you have to create a label and attach the calculation to it, using the text property.
Labels don’t have the property “displayType” so I think you’re mixing up dataproviders with labels
Sorry gang, i’m just not understanding how to set up HTML in servoy yet. Please be patient with me.
maarten:
changed displayType to IMAGE_Media
I don’t get this part.
The unstored calculation part seems ok, but then you have to create a label and attach the calculation to it, using the text property.
Labels don’t have the property “displayType” so I think you’re mixing up dataproviders with labels
When i look at the properties of my field, there’s is a property called “displayType”. The choices are: Text_field, Text_area, RTF_area, HTML_Area, Type_Ahead, Combobox, Radios, Check,Caldenar, Image_Media, Password
I chose Image_media as the display type. am i wrong? should i just leave it as text?
Here are my structure:
I have these fields ‘Walldata’, ‘WallMin’, ‘WallMax’, ‘WallFlagClac’
my calc for WallFlagCalc in dataprovidor is this:
if (Walldata < WallMin|| Walldata > WallMin)
{
return ‘
’;
}
else
{
return ‘
’;
}
THEN, I did steps 2 thru 4 posted above. With step for being %%WallData%% in the text property.