T-Square Posted December 1, 2005 Posted December 1, 2005 I'm hoping to create an initialization script that goes to a special layout with all my global fields on it and sets each of them to Null or 0. I planned to use a loop so that I would not have to enumerate every field I wanted to set, and go to each field on the layout and set it according to its field type (0 for number fields, Null for text fields). To do this requires that I be able to test the format of the current field, and if it's a number set to 0, and if it's text set to Null. Is that possible, or will I have to find some other way to get this set up? Thanks, David
Raybaudi Posted December 1, 2005 Posted December 1, 2005 Hi This calc give you the field type: MiddleWords ( FieldType ( Get(FileName) ; "FieldName" ) ; 2; 1 ) So, while in the loop, you can make an "if" with the calc: MiddleWords ( FieldType ( Get(FileName) ; Get(ActiveFieldName) ) ; 2; 1 )
comment Posted December 1, 2005 Posted December 1, 2005 I wonder if it makes much difference if a number field is empty or has a 0 value. Another option is to make the global fields auto-enter the default values. This should modify the globals whenever a new record is created (don't know how this works in a multi-user scenario, though).
T-Square Posted December 2, 2005 Author Posted December 2, 2005 Thanks, both. One of the number fields in question is going to be used in a relationship, and I need it to be set to 0 (although I suddenly wonder whether a relationship on a zero value will work... hmmm). comment--your idea about auto-entering the field values is interesting. I never thought about auto-entering global fields. Since I am talking about my central Globals table, I imagine I could have the startup script delete all (1) records in that table and create a single empty record. That would also take care of the accidental creation of extra records in the table. David
comment Posted December 2, 2005 Posted December 2, 2005 A relationship matching on zero value will work - but I'd be very reluctant to use it. The same concerns that you have regarding the global field apply further down the chain. For example, any calculation that filters the relationship needs to be bullet-proofed against returning a zero instead of a null result.
Lee Smith Posted December 2, 2005 Posted December 2, 2005 I wonder if it makes much difference if a number field is empty or has a 0 value. Interesting question, so i tested using 0 as a number the ID for a relationship. 0 has value in that case, because if you enter nothing the Portal is blank, enter 0 and the Portal works correctly. HTH Lee
T-Square Posted December 2, 2005 Author Posted December 2, 2005 Lee-- Thanks. I'd have found that out when I got back to my development machine, but it's nice to have clarification aforehand. comment-- I hear what you're saying, but I'm purposefully searching for records that have previously had a Paid variable set to 0, so that these records can be set to a PaymentID when the customer sends in their check. Without a doubt, I'll be watching what gets returned VERY closely, since I don't want to change payment values wrongly! Thanks! David
Recommended Posts
This topic is 6934 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now