I only need data in the record key fields, the rest can be defaulted.
So initially, I will do this.
Local record &MyRecord; Local number &i; &MyRecord = CreateRecord(Record.MYRECORDNAME); /* key fields */ &MyRecord.FIELD1.Value = &Var1; &MyRecord.FIELD2.Value = &Var2; &MyRecord.FIELD3.Value = &Var3; /* rest */ &MyRecord.FIELD4.SetDefault(); &MyRecord.FIELD5.SetDefault(); &MyRecord.FIELD6.SetDefault(); ... &MyRecord.FIELD9000.SetDefault();
It looks horrible.
Use this instead.
Local record &MyRecord; Local number &i; &MyRecord = CreateRecord(Record.MYRECORDNAME); /* default all fields */ For &i = 1 To &MyRecord.FieldCount Local Field &Field = &MyRecord.GetField(&i); &Field.SetDefault(); End-For; /* then proceed with key fields */ &MyRecord.FIELD1.Value = &Var1; &MyRecord.FIELD2.Value = &Var2; &MyRecord.FIELD3.Value = &Var3;
No comments:
Post a Comment