December 1, 200520 yr 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
December 1, 200520 yr 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 )
December 1, 200520 yr 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).
December 2, 200520 yr Author 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
December 2, 200520 yr 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.
December 2, 200520 yr 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
December 2, 200520 yr Author 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
Create an account or sign in to comment