hOw can i translate the string variable to record

madhuri.sys
Member Posts: 13
hi all,
i am using ado library for establish a connection with MS-Access database.
MS-Access table contains Navision Table Names.
i have got a string from a query dynamically, it contains Navision Table Name.
now i would like to initialize the Table with that name.
so that i can modify the navision Data.
hOw can i translate the string variable to record variable?
plz concern this as seriously....
thanks,
Ramesh.
i am using ado library for establish a connection with MS-Access database.
MS-Access table contains Navision Table Names.
i have got a string from a query dynamically, it contains Navision Table Name.
now i would like to initialize the Table with that name.
so that i can modify the navision Data.
hOw can i translate the string variable to record variable?
plz concern this as seriously....
thanks,
Ramesh.
0
Comments
-
This sample should give you a hhint on how to acomplish your task.
Define local variable of type record and subtype 2000000001 Object
also define a local variable Table of type RecordRef.
// This little sample of code will count the records in a table
Object.SETRANGE(Type,Object.Type::Table); // Only Tables have records. What?! You didn't know that?
Object.SETRANGE(Object.ID,1,10); // For this sample, count only records in tables 1..10.
Object.FIND('-'); // IF THEN? Hopefully you have some object in your database!
REPEAT
Table.OPEN(Object.ID); // Open Record reference to current table.
MESSAGE(Text000,Object.Vardas,Table.COUNT); // Show you what was found.
UNTIL Object.NEXT = 0;0 -
so in your case something like that should work (not tested)
Object.SETRANGE(Type,Object.Type::Table);
Object.SETFILTER(Object.Name,'TableNameYouGetFromADO');
IF Object.FIND('-') THEN Table.OPEN(Object.ID);0 -
that is OK..
but i am also getting the field names dynamically from Access table.
then i need to assign the valuesin navision like this...
here field name is a Text variable.
field name:=format(recorset.fields.item(i).value);
recordref.init;
recordref."field name" := 'asdf';
recordref.insert;
here i am getting the field name from another recordset.
while compiling it is getting an error message that the fieldname is nota field in the record.
if u mean the same then jus verify this again...
thaks..0 -
very similar to above 'Object' table there is a table called 'Field'
so define a variable (i called it reclField) of type Record of subtype Field
then use the following:YourFieldName:=format(recorset.fields.item(i).value); recordref.init; reclField.SETRANGE(TableNo, recordref.NUMBER); // set range on table number reclField.SETRANGE(FieldName, YourFieldName); // set range on field name IF reclField.FIND('-') // if there is a field YourFieldName in the table number recordref.NUMBER THEN BEGIN // then u get it by its number reclField."No." recordref.FIELD(reclField."No.").VALUE('asdf'); // assigning a new value recordref.insert; END;
//by the way how is it going there in India with Navision products and life in general ?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