Edit Attribute Fields Prev | Table of Contents | Next

Unless you are happy customizing your map with only black lines and red dots, you will want to add attributes to the objects you create. Before you can add attributes you need to define the fields in which to store the attributes. The Attribute Fields item in the Edit menu brings up the Edit Attribute Fields window, and allows you to do so.

A list of fields appears on the left side of the Edit Attribute Fields window. When you make a new file, it will contain a single unnamed field, shown in the list as "<unnamed>". To edit this field, click on "<unnamed>".


The field is highlighted, and the Edit and Insert buttons become available.


Click the Edit button.


The Edit Field window opens.


Point to the Name box and type a name.


Then choose a type. Character fields hold any alphanumeric text. Numeric fields are strictly for numbers. Logical fields hold 'T' (true) or 'F' (false). Date fields hold a date in a "YYYYMMDD" format.


If you chose Character or Numeric, you will also need to set the length of the field by using the + or - buttons next to the Length box. (Alternatively, you may point at the box, clear the old value with the Backspace key, and type a new value.) Make the field long enough to hold the longest value you expect to use in your file. Maximum length for character fields is 254; maximum for numeric fields is 18. For numeric fields include space for a minus sign and/or a decimal point, if you expect to use either.


If you chose Numeric, you will then need to set the number of decimal places -- that is, the number of digits you will need to the right of the decimal point. For instance, for dollars and cents you would set it to 2. If you will only be entering integers in this field, leave it at zero.


When you are satisfied with your new field, click OK.


The Edit Field window goes away, and the name of the new field appears in the Edit Attributes Fields window's list. The line of three dots below the name represents the end of the list. To add a new field to the end of the list, click on the line of dots.


The line of dots is highlighted. Click Insert to add a new field.

(Hint: You may insert at another place in the list by clicking on that place before clicking Insert.)
 
 




The line of dots moves down and is replaced by a new unnamed field which is highlighted and ready for editing. Click Edit to give it a name and set other parameters as already explained.


When you finish editing, the new name replaces "<unnamed>" in the list. Perhaps you would prefer it higher in the list? If so, click Move Up .


The field is moved up. Move Down, not surprisingly, does the opposite. But maybe you've decided that you didn't want that field after all. Click Delete.


The field is deleted. Maybe you've changed your mind again? If so, click Undelete.


The Undelete window appears. It has a list of fields that you have deleted since the last time you saved the file. Click the field you want to undelete.

(Hint: Don't forget that when you next save your file (which you do frequently, right?) any fields that you have deleted will be permanently removed, and no longer available to be undeleted.)


The field is highlighted. Click OK.


The Undelete window disappears, and the field is restored to the list in the Edit Attribute Fields window, at the highlighted position.

You may continue adding fields until you have enough to hold all of the attributes that you'll want for your objects. (Of course, there are limits: see Limits.) When you are finished, click Close.


All of the above showed how to add and edit attribute fields for a new file. In an ideal world you would always anticipate all of your needs and set up your fields accordingly before you began to enter data in the fields. But this is not an ideal world. Once you begin working with your file, it is likely that you will see ways to improve the format of your various attribute fields. Therefore XViewSDTS allows you to edit the fields even after you have begun adding data.

Obviously there are risks in doing that. If you shorten a field which already has data in it, you run the risk of chopping-off some data. If you change a field's type, you run the risk of losing any data in it that isn't valid for the new type. Some applications avoid these risks by simply not allowing you to edit the fields. We have chosen to allow you the flexibility of editing the fields, while warning you when there is a danger that doing so would lose data.

Still, the best policy is to think carefully about your needs when designing your fields, so that you'll never need to edit them later. We encourage you to use that policy. But if the need arises to edit a field, feel free to do so. The following explains some of the messages that may pop-up to assist you when editing fields in a file that already contains data.

Example
Field TypeCharacter
Field Length4
Data in record 1123
Data in record 21234
Data in record 3ABC
Consider a field in a file that has data in three records as described in this table.


If you try to shorten the length of the field, you will get this question. Answers Yes and No are self-explanatory. Answering Maybe will give you more information to help you make up your mind.


If you answer Maybe, you are given a summary of what you are trying to do, and the consequences of doing so. In this case, data from one record (example record 2) would be lost. You would now answer no, unless you really don't mind losing this data.


If you try to change the type of the field to a more restrictive type, you will get a similar question. Again, answering Maybe will give you more information to help you make up your mind.


If you answer Maybe, you are given a summary similar to the one you get when shortening a field. In this case, data from one record (example record 3) would be lost. As in the previous case, you would now answer no, unless you really don't mind losing this data.


If you try to both shorten the length of the field and change the type of the field to a more restrictive type, you will get a warning about both actions. As before, answering Maybe will give you more information to help you make up your mind.


If you answer Maybe, you are given a summary similar to the others, itemizing the potential data loss for each change, and the total potential data loss. In this case two of your three records contain data that would be lost.


Although you would answer no in all three cases above, if you were to get a summary that says that zero of your records would lose data, you could feel free to answer yes (assuming that you have taken the advice in the next paragraph!).

A word of caution: While we have tried to anticipate the various situations which could cause you to lose data, and warn you when those situations arise, editing fields is an activity which should be done with care. Therefore you should always make a backup copy of your file set before editing any fields that contain data.


Copyright © 2005 by Dapper Mapper


Edit Attribute Fields Prev | Table of Contents | Next