Presentation on theme: "FMPro Lecture 2 More about fields Administrative Changes in class: –No Quizzes, I will take time to answer questions at the beginning –Step by Step instructions."— Presentation transcript:
FMPro Lecture 2 More about fields
Administrative Changes in class: –No Quizzes, I will take time to answer questions at the beginning –Step by Step instructions will be available the day of the lab or before –Website: www.webmastergraffiti.com/~dioxn –If you need to miss a class I would recommend reading the lecture on-line and trying the lab you can ask questions at the next lecture
Quick Review Lecture 1 Defining the problem is the most important part Decide what fields to use and define them Design layouts
Discussion Any questions regarding last weeks lecture or lab material?
Help Use the FileMaker Pro online help system. Everything you need to know is there. To get there pull down the help menu –Choose FileMaker help… –Click on the contents button to browse or find if you are looking for info on a specific subject This is especially helpful for looking up information about functions. (Demonstrate)
Fields Topics to be covered: –More in depth info about specific field types –Information about verification and auto-entry options –Information about Indexing –More on calculations and value lists –Performing finds
In Depth on Fields Lets review defining fields: –Two ways to define fields: –At startup when you make a new DB you are presented with the define fields box –Go to File…Define Fields Naming Fields: –Give fields descriptive names
In Depth on Fields Naming Fields(ctd): –Only use letters, spaces and/or numbers in your names. If you use a number, don’t put it at the beginning of the field name (e.g. Name2 is ok, but 2dolist is not; to do list or toDoList would be better) –If you use special characters (I.e. +,-) in your names you can’t use the field in a calculation
Text Fields Text fields: –The most generic field type –Great for things like names, street also good for phone numbers, SS#s –While text fields can be used for everything don’t do it. Validations and Calculations are much easier with number, date or time types. –Can contain up to 64,000 characters
Number Fields Number Fields: –Up to 255 characters allowed on single line –Any character is allowable but, I would recommend only using numbers or you may get strange side effects –Sometimes these side effects can be used to your advantage. E.g. (if you have a SS# entered with the dashes you may want to be able to do a search without the dashes, storing as a number allows you to do this) more on this later
Date Fields Date Fields: –Can be inputted by user using the following separators (/,-,.) or a space (e.g. 5 7 2000 –Wide variety of formatting options available From layout mode click on the field and pull down the format menu and go to Date. –Calculations can be used to figure out date ranges etc. (shown later)
Time Fields Date Fields: –Can be inputted by user in the following ways: H, HH:MM, HH:MM:SS, HH:MM:SS:AM –Wide variety of formatting options available From layout mode click on the field and pull down the format menu and go to Time. –Calculations can also be used with Time fields (e.g. 10:30:50 - 10:30:10 = 40)
Container Fields –These can contain picture, QT movie or sounds –Use sparingly, these can add incredible size to your database –A good example would be if you wanted to eliminate the necessity for picture ID’s. You could do this by having a container field that contained the students picture To use simply select and go to edit paste after copying the desired picture
Calculation Fields Calculation Fields: –Unlike other fields you will be presented with a calculation screen if you select this. –There are a myriad of possible calculations to implement –Calculation results are generated by FileMaker and cannot be modified by the user. If you need a default calculated value that can be modified, use a field with auto-entry instead.
Summary Fields Summary: –These combine information across all “found” records. –I will include only a cursory discussion of summary fields today. More to be covered in lecture on layouts and sorting. –When you define a summary field a dialog will prompt you with the types of summary fields.
Summary Fields Summary(ctd): –Function Total = gives you a total of the field in the found set can be used with number, date, time, but not text Average = Total/count Count = number of records containing something in that field Min & Max = minimum and maximum value in set Standard deviation ~ a measure of variance from average how much do the values differ
Global Fields Global Fields: –Great for use in scripts or to set up changeable variables that are consistent throughout all records. –E.g. you can use a global variable to capture the name of the user so that letters are signed by them. –Although beware, each computer in a multi- user environment get their own set of global variables
Global Fields Global Fields(ctd): (tip)In FileMaker it is possible to validate global values. To do so: –Open file…define fields –Create a field of the same type (e.g. text) –Set the validations options(will be shown next) –Click on the field again –Click the global radio button, and then hit Save –It may give you a warning just click ok –Voila… validation on a global field
Auto-Entry Auto-Entry can set default values for fields –We saw an example of this when we auto- entered the date in the last lab –This can eliminate the need for extraneous typing by the user or store values we don’t want the user to input (e.g. input the name of the user who created and/or modified the field) –To get there simply click on the options button after you’re done defining a field
Auto-Entry –This is what the screen should look like –The first pull down menu let’s you input creation and modification info, this is limited by type of field though (e.g. a date field can’t contain creator name
Auto-Entry –Ignore serial number and value from previous record for now –Data allows you to put static text in (like a default date etc.) –Calculated value let’s you put in a default value from a calculation –Lookup allows you to look up the value from a related database (we’ll see this later)
Auto-Entry –Prohibit modification will only be available if another option is selected, use this if you want your auto-inputted text to be the final word (e.g. here the last modifier of this record will be logged)
Auto-Entry Don’t worry about repeating fields in most cases relationships do a better job. Now on to validations
Validations –If you pull down the menu on top that says Auto Enter you will be presented with this screen –Validations are used to make sure the user inputs information in the correct form
Validations Not empty and unique are self explanatory. Existing is the opposite of unique (I.e. this value must exist in another record) Member of value list allows you to use a value list to make sure this field contains one of the values (value list - think a pull down menu with all the states in it) In range allows you to set a range that a value must fall between usually done for numbers, dates, or times
Validations By Calculation with calculation the field will be valid if the value of the calculation is a 1 or true, it will be not valid if the value is 0 or false If you select strict the user cannot override your validation (use this if this field is vital in a calculation or sort) You can also have a custom message pop up by clicking display custom message, this may be helpful to instruct the user what to do, this is essential if you chose strict, otherwise the user won’t know what you are checking for
Indexing At the bottom of the validation field is a button that says storage this enables indexing. A good analogy would be to a book –A book with an index in the back makes it a lot faster to find a specific word in the book, but it makes the book bigger –In a database turning on indexing speeds up searches but results in faster searches
Indexing Usually it’s ok to leave this on the default setting, if you want to increase speed you may want to turn on indexing of fields that will be searched or sorted upon One thing to watch out for, with calculation fields there is an additional option, do not store result, you should only use that if you are referencing a status formula, or it can slow down your screen redraws.
Calculations Big Picture: –Calculations can either return a value (e.g. turn first name and last name fields into a full name) or a boolean (yes/no value used in validation e.g. if length equals 5 it’s ok else it’s not) –Calculations can be either very simple or very complex –Today we’ll only go over the simple calculations, we’ll cover more complex calcs towards the end
Calculations –Your first step in doing a calculation should be to do it on paper in English. –Then think about what functions you could use to implement it (part of the lab involved checking the help functions for definitions of functions) –Code it –Test it, make sure it works
Calculations Simple calculations: –You can use the following arithmetic operators just like in excel etc. (+,-,*,/,^) (e.g. in a field you could have amount * salesTax) –With text you can use & to append two pieces of text (e.g. lastName & “, “ & firstName would output lastname, firstname) –The quotes above indicate text (as opposed to a field name) for example if your calculation had “hello” your field would contain the word hello
Calculations Simple calculations: –You can also use built in functions part of this lab involves reading about these so I’ll only show a few examples and basic syntax –Left returns a text that contains the number of characters given. (e.g. left(field1,3) would give you the first three characters of field1 –Round(tax,2) this function returns the result of rounding the tax field to two digits
Calculations Simple calculations: –So as you can see with these functions you will usually use the syntax function name(field name,argument) some functions do not require the argument, check under the help menu to see the formatting –Calculations can get a lot more complicated with nesting and chaining, but we won’t see that until the last week.
Calculations Simple calculations for validations: –With validations you want to return a true or false not a text or number value –To do so you can use the logical operators: = (e.g. field1 = field2 this checks that these fields are equal and returns true or false) <> means not equal (opposite of above) > or >= means greater than or greater than or equal to (e.g. tax >= 7.75 will only allow values equal to or greater than 7.75
Calculations Simple calculations for validations: –You can also use functions with validations IsEmpty(field1) this will return true if field1 is empty and return false otherwise Date = Today this will return true if the date in the Date field is equal to today’s date –We will do more with calculations in the future especially when we get into scripting
Value Lists Value lists are used for things like pull down menus or for validating data as you saw earlier –To define a value list go to the file menu and choose define then value lists –Type a name and then hit create to make a new Value list then click in the lower right hand box and type your values (e.g. male, female) hit return between values
Value Lists To see these in the layout, make sure you’re in layout mode and then click on the field you want to use and go to the format menu to field format and click on the button next to pop-up menu, then change the value list next to it to the one you defined. More on this next lecture when we talk about layouts
Finding records To perform a find click on the mode menu and go to Find, then you can click in any field and type in your find criteria –You can click on the omit check box to find all records that don’t meet that criteria –You can choose the symbol pop up menu to search for duplicates or in range etc. (more on this in a later lecture)