On button click Read from table current row

giovannixyz
Member Posts: 13
How Can I read from table
I added button on form, in section onPush()
I added code
string_my:= Name_of_record."Field_in_table";
Message(string_my);
allways is is empty, but in table is data.
Please help
I added button on form, in section onPush()
I added code
string_my:= Name_of_record."Field_in_table";
Message(string_my);
allways is is empty, but in table is data.
Please help
0
Comments
-
giovannixyz wrote:
string_my:= Name_of_record."Field_in_table";
Message(string_my);
Did u write
Name_of_record.Get;
before these above two statements?0 -
No need for GET. When you're on a form, the current record is called 'Rec'. When you select it from the object browser, it even gets left out. Try this code:
MESSAGE(FORMAT("Field In Table"));
Leave out the "name of record" part0 -
"Name of the record" to access the current record is "Rec". But you can skip the Rec. part because all code on the form is virtually done with command "With rec do" (thus Rec. is not needed in the code, it will be added automatically in the background). I recommend to read basic documentation for developers to see how the Rec. and xRec. variables are working...0
-
name of record when I read was to much. thanks. =D>
now I have in string name, address and post code
and I try to write into record
with name_of_record."name_of_field" := string_name;
I also try "name_of_field" := string_name;?0 -
It doesn't look like you need the "name_of_record" variable. Just like the other example, you can assign values to just the field name, that will set those values to the current record on the form.
You know, instead of trying to come up with something like 'name_of_record' and 'name_of_field', why don't you just use the same record and field names that you are working with? Also, explain to us what the functional requirement is, so we understand what it is that you're trying to do. There might be a different way to approach your problem.0 -
I try to modify table Sales header. Field "Sell-to Customer Name"
I have record GlavaProd on table Sales header
complete code will be in section OnPush() in my Button
GlavaProd.GET;
GlavaProd."Sell-to Customer Name" := ime_priimek; // this is my string
GlavaProd.Modify;
on button click there is no change on form.0 -
Think about what you're trying to do. You are trying to set the sell-to customer name on the sales header, so why are you doing a MODIFY on your GlavaProd variable? Where are you setting the value of your ime_priimek variable?
I am assuming that you are trying to retrieve the value from the GlaveProd table, and setting the field on the sales header with the name from that record.OnPush() IF GlavaProd.GET THEN VALIDATE("Sell-to Customer Name",GlavaProd."Sell-to Customer Name");
or simply assigning the field:OnPush() IF GlavaProd.GET THEN "Sell-to Customer Name" := GlavaProd."Sell-to Customer Name";
And if the value doesn't show up then add a CurrForm.UPDATE in there.0 -
Thanks for help everything was ok, but I didn`t know about CurrForm.UPDATE;
when I added this it started to work.
funny that when I walked by Customers (form didnt refresh it self`s)
anyway now works, thanks again. =D>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