Kevin consider using KEYS. With KEYS it would all of the fields to match before the record is edited. For example let's say you have a ten field sub-file and the .01, .02, and .03 are KEYS. Let's also say there is an existing sub-file record: .01=My Sub-file Record .02=My First Key1 .03=My First Key2 <and so on>
Now we create a record with the following values: .01=My Sub-file Record .02=My First Key1 .03=My First Key3 <-- <and so on> This record will be added to the sub-file because of the non-matching values. KEYS act like Required Identifiers. I hope this give you some food for thought Kevin. --Skip -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Toppenberg Sent: Wednesday, September 08, 2004 10:16 AM To: [EMAIL PROTECTED] Subject: Re: [Hardhats-members] Adding records with multiples Greg, Thanks for your reply. I want to be able to run my script, and then--if needed--run it again, without it adding new entries each time. So sometimes I will be adding records, and sometimes stuffing old ones. I think the specier "?+" will cover this situation. The only limitation of this is that I think it only uses the ".01" field when searching for a pre-existing record. I wanted to have my script be more flexible than that. I think I will be able to use what you have told me to come up with a solution. I'll ask more later if I need. Thanks again Kevin --- Greg Kreis <[EMAIL PROTECTED]> wrote: > The 2 is the IEN in the multiple. You don't want to encode the > literal IENm, as you adding values, not accessing existing ones. > Instead, look into the 'extended IENS' concepts of + and ?. The use of > + requests a record to be added in the multiple and the ? permits the > value to be 'found' before deciding to add (if the + accompanies it). > While simplistic, this lets you avoid duplicating entries. > > So you might use an IENS of '+9,250' where the 250 is IEN 250 in the > main file and +9 means you are requesting the addition of an entry in > the multiple. I used 9 to indicate it is just a placeholder and is > only needed if you want to discover the IEN that was created for the > new entry in the multiple (the 9 is a subscript in a returned array of > assigned IENs). > > Kevin Toppenberg wrote: > > >I am trying to wrap my mind around adding data with multiples. I > >wonder if someone can help me. > > > >My goal is to enable my scripting system to process the following > >request: > > > > <File id="TestMenu" File="OPTION"> > > <Field id="NAME">TestMenu</Field> > > <Field id="MENU TEXT">Test2</Field> > > <Field id="CREATOR">Dodd,Norman"</Field> > > <Field id="Short Menu Text">Some Short > Text</Field> > > <Field id="DELEGABLE">YES</Field> > > <Field id="TYPE">menu</Field> > > <Field id="MENU/.01">DIUSER</Field> > > <Field id="MENU/SYNONYM">FM2</Field> > > <Field id="MENU/DISPLAY ORDER">1</Field> > > <Field id="MENU/.01">XMMGR</Field> > > <Field id="MENU/SYNONYM">X2</Field> > > <Field id="MENU/DISPLAY ORDER">1</Field> > > </File> > > > >I parse the above into the following structure, > with > >this format: > >Data(EntryNumber,FieldNum,[SubEntryNumber,FieldNumber]) > > > >Data(0,"Entries")=7 > >Data(0,"File")=19 > >Data(0,"File","Global")="^DIC(19," > >Data(1,.01)="TestMenu" > >Data(1,.01,"MatchThis")=1 > >Data(2,1)="Test2" > >Data(3,3.6)="Dodd,Norman""" > >Data(4,10.1)="Some Short Text" > >Data(5,13)="YES" > >Data(6,4)="menu" > >Data(7,10,0,"Entries")=2 > >Data(7,10,0,"File")=19.01 > >Data(7,10,1,.01)="DIUSER" > >Data(7,10,1,.01,"MatchThis")=1 > >Data(7,10,1,2)="FM2" > >Data(7,10,1,3)=1 > >Data(7,10,2,.01)="XMMGR" > >Data(7,10,2,.01,"MatchThis")=1 > >Data(7,10,2,2)="X2" > >Data(7,10,2,3)=1 > > > > > >I am able to work with the standard > ("non-multiple") > >fields without any problem. I use FILE^DIE to > stuff a > >pre-existing record with the data that I want, or I use UPDATE^DIE if > >I need to create a new record. I > do > >a search for pre-existing data based on the "MatchThis" entries, and > >get an IEN (internal entry > >number) of the record to work with. > > > >But now I am working to get the sub-file part > working. > > I don't know how to get the IEN of the subfile entries. > > > >In the above example, I am working with the OPTION file. Field > >MENU(#10) is a multiple, meaning that when I add data to that field, > >the database really holds a list of 'pointers' to entries in another > file. > > I.e. the MENU sub file number is 19.01. So If I > have > >2 'multiple' entries in field 10, then field 10 > holds > >2 pointers to 2 separate entries in file 19.01. I suppose these 2 > >pointers are really IEN's--though > I'm > >not sure how to get at them. > > > >So when I go to set up my FDA array to pass to the database, I need: > > - File or subfile number -- Got this OK > > - IENS -- I think this is my area of confusion. > (see > >below) > > - Field# -- field to access -- got this OK > > - Value -- got this OK. > > > >Re IENS, the documentation says the following: > > An IENS is a comma-delimited list of internal > entry > >numbers beginning with the lowest level subentry > and > >ending with the top-level entry number. Regardless > of > >how many levels exist, a "," is appended to the > end. > >For example, to specify subentry 2 in a multiple > for > >entry 250, IENS would equal "2,250,". The corresponding values for > >the DA() array would be > DA=2 > >and DA(1)=250 (or D0=250 and D1=2). If you were referencing the top > >level of the file, the IENS > would > >be "250,"; DA=250 or D0=250. > > > >What I don't understand is "to specify subentry 2 > in a > >multiple for entry 250, IENS would equal "2,250," " > >(The DA explainations don't help me, because I'm > not > >used to using the old interface either) > > > >Is this "subentry 2" mean the second subentry of a specified multiple > >field, or fieldnumber=2 ? > > > >Also, I think I will need to search to see if the subentries already > >exist, and call different > functions > >depending on whether I need a new record vs. > stuffing > >an old one. > > > >So, to summarize, how would should my FDA look for > the > >above data? Can it be done in one call, or would multiple calls > >(i.e. separate calls for the > >subentries) be needed? > > > >I know this was a long post. Thanks for reading it. > >:-) > > > >Thanks. > > > >Kevin > > > > > > > > > >__________________________________ > >Do you Yahoo!? > >New and Improved Yahoo! Mail - 100MB free storage! > >http://promotions.yahoo.com/new_mail > > > > > >------------------------------------------------------- > >This SF.Net email is sponsored by BEA Weblogic > Workshop > >FREE Java Enterprise J2EE developer tools! > >Get your free copy of BEA WebLogic Workshop 8.1 > today. > >http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > >_______________________________________________ > >Hardhats-members mailing list > >[EMAIL PROTECTED] > >https://lists.sourceforge.net/lists/listinfo/hardhats-members > > > > > > > > -- > Greg Kreis Pioneer Data Systems, > Inc. > http://www.PioneerDataSys.com - VistA Training and Consulting > > "Genius is childhood recaptured at will." (Charles > Baudelaire) > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > === message truncated === __________________________________ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click _______________________________________________ Hardhats-members mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hardhats-members ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_idP47&alloc_id808&op=click _______________________________________________ Hardhats-members mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hardhats-members