FieldRef and RecRef Question

nismo2006
Member Posts: 22
Good Day,
I have a question regarding using references. I have a routine that dynamically grabs the table number from a recordset (110 = Sales Shipment Header), filters it based on certain criteria and gets records from that. I have all of these values stored in a Rec Ref and Field Ref variable. I then have to pass this information into an XMLPort and export it. The XML Port wants a specific filtered table but I can't figure out how to determine dynamically what table I am using and how to filter it. I cant pass the reference values. Is there anyway to define a variable to dynamically point to a specific table, filter it and pass it to the XML Port export. I appreciate the help in advance.
RecRef.OPEN(TableNo);
FelRef1 := RecRef.FIELD(EDIConfigRec.FieldFourToFilter);
FelRef2 := RecRef.FIELD(EDIConfigRec.FieldTwoToFilter);
FelRef3 := RecRef.FIELD(EDIConfigRec.FieldOneToFilter);
FelRef4 := RecRef.FIELD(EDIConfigRec.FieldThreeToFilter);
FelRef1.SETFILTER('%1',EDIConfigRec.FieldFourFilterValue);
FelRef2.SETFILTER('%1',EDIConfigRec.FieldTwoFilterValue);
FelRef3.SETFILTER('%1',EDIConfigRec.FieldOneFilterValue);
FelRef4.SETFILTER('<>%1',EDIConfigRec.FieldThreeFilterValue);
XMLPORT.EXPORT(OutboundPort,OutS,??TableRef.GETTABLE(TableNo)??);
I have a question regarding using references. I have a routine that dynamically grabs the table number from a recordset (110 = Sales Shipment Header), filters it based on certain criteria and gets records from that. I have all of these values stored in a Rec Ref and Field Ref variable. I then have to pass this information into an XMLPort and export it. The XML Port wants a specific filtered table but I can't figure out how to determine dynamically what table I am using and how to filter it. I cant pass the reference values. Is there anyway to define a variable to dynamically point to a specific table, filter it and pass it to the XML Port export. I appreciate the help in advance.
RecRef.OPEN(TableNo);
FelRef1 := RecRef.FIELD(EDIConfigRec.FieldFourToFilter);
FelRef2 := RecRef.FIELD(EDIConfigRec.FieldTwoToFilter);
FelRef3 := RecRef.FIELD(EDIConfigRec.FieldOneToFilter);
FelRef4 := RecRef.FIELD(EDIConfigRec.FieldThreeToFilter);
FelRef1.SETFILTER('%1',EDIConfigRec.FieldFourFilterValue);
FelRef2.SETFILTER('%1',EDIConfigRec.FieldTwoFilterValue);
FelRef3.SETFILTER('%1',EDIConfigRec.FieldOneFilterValue);
FelRef4.SETFILTER('<>%1',EDIConfigRec.FieldThreeFilterValue);
XMLPORT.EXPORT(OutboundPort,OutS,??TableRef.GETTABLE(TableNo)??);
0
Comments
-
I'm afraid you have to use a CASE structure, and declare x-number of rec-variables based on RecRef.NUMBER.
CASE RecRef.NUMBER OF DATABASE::Item: XMLPORT.EXPORT(OutboundPort,OutS,recItem); DATABASE::Customer: XMLPORT.EXPORT(OutboundPort,OutS,recCustomer); ... END;
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
Or you can base the XMLPOrt on Integer table and pass the RecRef as parameter of some function. Than call the XMLPort throug variable of type XMLPort... ;-)0
-
Worked great! I appreciate the help and have a good day.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions