GETRANGE

hi ,

i am very new to navision and just now started exploring with coding part…

i have a task to autofill the remaining fields,if i select a field with lookup table…

example:- If my form has customer No,name,assdress,state,pin code etc… if i select the customer no. every other fiels should be filled…

i tried with get function…its working fine…but Setrange,Setfilter are’nt working error is comin

IF RecCustomer.SETRANGE(“No.”,‘10000’,‘62000’); then
BEGIN
“Customer Name” :=RecCustomer.Name;
Address :=RecCustomer.Address;
“Address 2” :=RecCustomer.“Address 2” ;
City :=RecCustomer.City ;
State := RecCustomer.“State Code”;
“Post Code” :=RecCustomer.“Post Code”;
“Phone No.” := RecCustomer.“Phone No.”;
“Fax No.”:=RecCustomer.“Fax No.”;
“Email Address”:=RecCustomer.“E-Mail”;
MODIFY;
END;

ERROR:- THe expressiion is void,there must be a true false expression…

Wats wrong with my codin…kindly help,thanks in advance…

Hi Check first line of code

if RecCustomer.setrange(“No.”,“10000”,“62000”) then instead of this it should be like below

RecCustomer.SETRANGE(“No.”,‘10000’,‘62000’);
If RecCustomer.find first then
BEGIN

your code

end;

ya, tried…but if i do so…

i am getting only for first customer no correctly…if i select another number, the same name, address etc for 1st customer is only coming

use like below

RecCustomer.SETRANGE(“No.”,‘10000’,‘62000’);
If RecCustomer.find first then
BEGIN

Repeat

your code

Until RecCustomer.next = 0;

end;

now the condition became opposite… now the name,address etc of 62000 is only coming…not changing…:frowning:

now the condition became opposite… now the name,address etc of 62000 is only coming…not changing…:frowning:

now the condition became opposite… now the name,address etc of 62000 is only coming…not changing…:frowning:

RecCustomer.SETRANGE(“No.”,‘10000’,‘62000’);
If RecCustomer.find first then
BEGIN

Repeat

your code

RecCustomer.modify(true);

Until RecCustomer.next = 0;

end;

NO CHANGE BRO…[:'(]

What exactly are you trying to do? If you are just trying to display the customer information, then just display the record you are retrieving. Why are you creating the new record?

t

am not trying to create a new rcrd nd al…if i select the customer no frpm the lookup table,the following fields should be autofilled …am getting it using GETfunction…my doubt is wats wrong in n that code??? how to use setfilter,setrange here???

Hi,

i hope you have created new customer table and give look up to No field. so that you can select the customer from the lookup. once you have selected a single customer his name,address should be filled in rest of the fields for this you have to write code on

No. - OnValidate() trigger of newly created table code is

IF “No.” <> xRec.“No.” THEN
BEGIN
RecCust.SETRANGE(RecCust.“No.”,“No.”);
IF RecCust.FINDFIRST THEN
BEGIN
Name := RecCust.Name;
“Search Name” := RecCust.“Search Name”;
“Name 2” := RecCust.“Name 2”;
Address := RecCust.Address;
END;
END;

variables used are

Name DataType Subtype
RecCust Record Customer

this will update only one record at a time :slight_smile:

Thanks

Jerome marshal. J