RE: [Hardhats-members] Adding records with multiples
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=NAMETestMenu/Field Field id=MENU TEXTTest2/Field Field id=CREATORDodd,Norman/Field Field id=Short Menu TextSome Short Text/Field Field id=DELEGABLEYES/Field Field id=TYPEmenu/Field Field id=MENU/.01DIUSER/Field Field id=MENU/SYNONYMFM2/Field Field id=MENU/DISPLAY ORDER1/Field Field id=MENU/.01XMMGR/Field Field id=MENU/SYNONYMX2/Field Field id=MENU/DISPLAY ORDER1/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
Re: [Hardhats-members] Adding records with multiples
I like Skip's idea as well. Perhaps KEYS are right on the money for your goal. Greg Kreis wrote: If you want more control that ?+, you could do your own retrievals into the multiple with a DBS call, apply your logic and then use the IENs returned by the lookup to set the IENS for the updater... Good luck! Kevin Toppenberg wrote: 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
Re: [Hardhats-members] Adding records with multiples
Where do I learn more about how to use KEYS? Thanks Kevin --- Greg Kreis [EMAIL PROTECTED] wrote: I like Skip's idea as well. Perhaps KEYS are right on the money for your goal. Greg Kreis wrote: If you want more control that ?+, you could do your own retrievals into the multiple with a DBS call, apply your logic and then use the IENs returned by the lookup to set the IENS for the updater... Good luck! Kevin Toppenberg wrote: 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=NAMETestMenu/Field Field id=MENU TEXTTest2/Field Field id=CREATORDodd,Norman/Field Field id=Short Menu TextSome Short Text/Field Field id=DELEGABLEYES/Field Field id=TYPEmenu/Field Field id=MENU/.01DIUSER/Field Field id=MENU/SYNONYMFM2/Field Field id=MENU/DISPLAY ORDER1/Field Field id=MENU/.01XMMGR/Field Field id=MENU/SYNONYMX2/Field Field id=MENU/DISPLAY ORDER1/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 === message truncated === __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! 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=5047alloc_id=10808op=click ___ Hardhats-members mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hardhats-members