wrong variable amount for method!

Hello guys ,

I am trying to init the field from another table to my table

I tried to write code to table like that:

but gives me error like I could not get right amount of variables for my txtdefault method.

My txtdefault method down belown there:

//BP Deviation documented
edit ItemFreeTxt  txtDefault(
    boolean         set,
    ItemFreeTxt     txt
    )
{

    LanguageId  languageId  = CompanyInfo::languageId();
    InventTxt   inventTxt   = InventTxt::find(this.ItemId,languageId);

    if (set)
    {
        ttsbegin;

        inventTxt               = InventTxt::find(this.ItemId,languageId,true);
        inventTxt.ItemId        = this.ItemId;
        inventTxt.LanguageId    = languageId;
        inventTxt.Txt           = txt;
        inventTxt.write();

        ttscommit;
    }

    return inventTxt.Txt;
}

I do not understand why I am getting error.

could you guys help me please?

The error likely says that you’re calling the method with a wrong number of parameters. The method needs two parameters, while you provided only one. You forgot the text.

I thought txt is optional cuz it is not bold.So Should I add like .txt(true,this.txt) like that?

You have the answer in front of you, you just have to look at it.

edit ItemFreeTxt  txtDefault(
    boolean         set,
    ItemFreeTxt     txt)

Do you see any optional parameter there? Is there any default value for any argument? No, it’s not, both are non-optional.

The first parameter is highlighted in IntelliSense because that’s what you’re working with in the editor. If you add a comma, the second parameter will be highlighted instead. Optional parameters are shown in [].

If the text was optional, then what is purpose of using that method? (as you are trying to set the first parameter as true).
If you are only looking to get (but not setting it) the text use txtDefault(false, “”)
or directly call the, InventTxt::find(this.ItemId,CompanyInfo::languageId(););

InventTable::find(this.ItemID).txtDefault(InventTxt::find(this.ItemId,CompanyInfo::languageId()).Txt;
should it something like taht kranthi?they want me to init this txtdefault() field to my table’s axsPurchNote.Basically I have to init txtdefault to another table’s purchNote field

this.axsPurchNote = InventTxt::find(this.ItemId,CompanyInfo::languageId()).Txt;

this.axsPurchNote = InventTable::find(this.ItemID).txtDefault(false,InventTxt::find(this.ItemId,CompanyInfo::languageId()).Txt); should not using txtdefault cuz They want init from it to purchNote.

What does that mean?

Is the below code not working?

this.axsPurchNote = InventTxt::find(this.ItemId,CompanyInfo::languageId()).Txt;

If you are forced to use txtdefault method, then try below.

this.axsPurchNote = InventTable::find(this.ItemID).txtDefault(false,“”);

I tried both of them but it did not work it.

Then there is something wrong. Are getting value in this.ItemId? Try debugging.

i debug it and it does not initing the value of txt to purchNote.I checked I tem Id it comes right.

Check in InventTxt table to see, if you have a value with ItemId and company language id.

checked it it has it.what can be a reason I can see PurchNote field is empty?why initing is not working on PurchNote field.normally it must be work ,they have realiton above ItemId and ItemId is correct

In your debugging, are you getting a value in PurchNote? Is InventTxt::find returning a record?

actually I could not get into debug on initfrom method so I put On txtdefault method of InventTable ,but It did not show the purchNotes,How can I get into debug on PurchrequestTable

Where you have written your code? What user action should update that field?

I figured out thank you so much for your helps.I wa doing wrong testing.It works actually.