forms

surisuri Member Posts: 123
hi good evening,
i am running a form fixed assets
in this we have card and sub forms,in subform we have acquisition cost field.
the values in the acquisition cost field must effect the amount field in the fa journal line
i have written the code in FA Depreciation Book table
in acquisition cost onvalidate()

temprec.RESET;
"Acquisition Cost" :=0;
temprec.SETRANGE(temprec."FA No.","FA No.");
IF temprec.FINDFIRST THEN
REPEAT
temprec.INSERT;
temprec.Amount +="Acquisition Cost";
temprec.MODIFY;
UNTIL temprec.NEXT=0;
i have written the code as shown above but it was not effecting in the amount field;
is it correct or wrong can any one suggest me please
thanks

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Are you entering any value in Aquistion cost field?

    if not why did you write code in acquisition cost onvalidate() trigger?
  • surisuri Member Posts: 123
    mahana sir
    thanks for giving reply
    i dont know where i have to write the code ,
    i tried a little bit with this code ..
    i am not entering any values .
    can any one suggest me please
    thanks
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    First of all writing code in form is not prefered.

    But still I suggest you to read form triggers and control triggers how to use and when to use..
  • SavatageSavatage Member Posts: 7,142
    I suggest you to read form triggers and control triggers how to use and when to use..
    Trigger Central:

    http://msdn.microsoft.com/en-us/library/dd301068.aspx
  • surisuri Member Posts: 123
    hi good evening.
    i have tried this code to enter the values from report to forms..
    where i have taken one data-item fixed assets
    and two temporary records fa journal line and fadepreciation book
    i kept the property processing only=yes..
    while running the report it was showing all the acquistioncost..
    but my actual requirement is the values in the acquistioncost must be inserted into the amount field in the journal line form
    is it possible through this coding ,

    can any one suggest me ..
    thanks


    Fixed Asset - OnAfterGetRecord()
    fadebook.RESET;
    fadebook.SETRANGE(fadebook."FA No.","Fixed Asset"."No.");
    IF fadebook.FINDFIRST THEN
    fadebook.CALCFIELDS(fadebook."Acquisition Cost");
    MESSAGE('%1',fadebook."Acquisition Cost") ;

    linecount:=0;

    fajline.SETRANGE(fajline."Journal Template Name",'ASSETS');
    fajline.SETRANGE(fajline."Journal Batch Name",'default');
    fajline.INIT;
    fajline.VALIDATE(fajline."Journal Template Name",'ASSETS');
    fajline.VALIDATE(fajline."Journal Batch Name",'default');
    IF NOT fajline.FINDLAST THEN
    fajline."Line No." :=linecount+10000
    ELSE
    fajline."Line No.":=fajline."Line No."+10000;
    fajline.INSERT;
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Where did you write code to Insert acquistioncost in to Amount field in above code?
  • surisuri Member Posts: 123
    thanks mohana.
    for your reply
    i am sending the screen shot ,what the form is actually effecting after writing this code
    fa.PNG 22.6K
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    I guess it is working fine as per what you have written?
    what else are you expecting from your code?
  • surisuri Member Posts: 123
    ya mohana sir
    the above screen shot where i have shared to you.
    is displaying only one number multiple times.
    where the amount field is 0.00
    but in fadepriciation book consist of acquistion field
    which consist of values
    32000
    45000 and so on
    these values must be inserted in the place of amount field
    instead of 0.00 values
    is it possible
    can you suggest me
    i sharing the screen shot what the actual output i got in the amount field
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Is there any code else than above?
    You didnt write to insert FA No. in above code but it is shown in attached scrren.

    Please share all Code whatever you have written.
  • surisuri Member Posts: 123
    ya mohana sir

    i haven't written any code .what i have written i shared to you can you please suggest me
    thank you
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Then how is it inserting FA No.?

    Can you tell me please?
  • surisuri Member Posts: 123
    good morning one and all

    while i writing only this code in onaftergetrecord()

    fadebook.RESET;
    fadebook.SETRANGE(fadebook."FA No.","Fixed Asset"."No.");
    IF fadebook.FINDFIRST THEN
    fadebook.CALCFIELDS(fadebook."Acquisition Cost");
    MESSAGE('%1',fadebook."Acquisition Cost");

    and running the report,there were no records updating in the table journal line

    while i writing only this code in onaftergetrecord()

    fajline.RESET;
    linecount:=0;
    fajline.SETRANGE(fajline."Journal Template Name",'ASSETS');
    fajline.SETRANGE(fajline."Journal Batch Name",'default');
    fajline.INIT;
    fajline.VALIDATE(fajline."Journal Template Name",'ASSETS');
    fajline.VALIDATE(fajline."Journal Batch Name",'default');
    IF NOT fajline.FINDLAST THEN

    fajline."Line No." :=linecount+10000

    ELSE
    fajline."Line No.":=fajline."Line No."+10000;
    fajline.INSERT;

    the table journal line was updating the records of about 10 records
    this is what going on sir
    what i am getting is that i have done mistakes in second code
    is it right
    can any one suggest me the code
    thanks
  • surisuri Member Posts: 123
    ya mohan sir


    Fixed Asset - OnAfterGetRecord()
    i have modified the code that is (fajline.Amount :=fadebook."Acquisition Cost";)
    after writing this code the amount field is getting/inserting values in fajournalline but the fano is same for all the amount fields i am sharing the screen shot what i got.

    fadebook.RESET;
    fadebook.SETRANGE(fadebook."FA No.","Fixed Asset"."No.");
    IF fadebook.FINDFIRST THEN
    fadebook.CALCFIELDS(fadebook."Acquisition Cost");
    MESSAGE('%1',fadebook."Acquisition Cost");


    fajline.RESET;
    linecount:=0;
    fajline.INIT;
    fajline.SETRANGE(fajline."Journal Template Name",'ASSETS');
    fajline.SETRANGE(fajline."Journal Batch Name",'default');
    fajline.VALIDATE(fajline."Journal Template Name",'ASSETS');
    fajline.VALIDATE(fajline."Journal Batch Name",'default');
    IF NOT fajline.FINDLAST THEN
    fajline."Line No." :=linecount+10000

    ELSE
    fajline."Line No.":=fajline."Line No."+10000;
    fajline.Amount :=fadebook."Acquisition Cost";
    fajline.INSERT;
    fa.PNG 22.4K
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Validate Amount field as "Journal Template Name" is doing and also FA No.
Sign In or Register to comment.