Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

customization search sales line gridview

(0) ShareShare
ReportReport
Posted on by 2,016

greeting everyone

i'v create edit string to search by barcode and change value of delivery now to

how can i do that?

pastedimage1602678009530v2.png

i'm trying this code but still give me error

salesLine_ds    = _salesLine.dataSource();
    localSalesLine  = salesLine_ds.getFirst(true) as SalesLine;

    if (localSalesLine)
    {
        while (localSalesLine)
        {           
            localSalesLine.SalesDeliverNow  =1;
        }
    }

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: customization search sales line gridview

    In the modified method of your checkbox, you can call my method.

    How exactly to call it depends where you put the findByBarcode method.

    Let's assume you put it on the form. Then you can call it by element.methodName().

    So, put following code in the modified method of your text box:

    element.findByBarcode(SalesTable.SalesId, this.valueStr());

  • mohammed.mqi Profile Picture
    mohammed.mqi 2,016 on at
    RE: customization search sales line gridview

    thanks for helping

    but i think i do mistake with textbox method because method not accept to declare (SalesId _salesId, ItemBarCode _barcode)

    any suggestion for how to search from  salesTable_ds

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: customization search sales line gridview

    I trust that you can apply my example code and use it on your form, so that it's triggered when the user inputs something in the box.

    If not, just let me know.

  • mohammed.mqi Profile Picture
    mohammed.mqi 2,016 on at
    RE: customization search sales line gridview

    ok thanks but how about the method because i'm using control (editstring )

    and method inputSearch()

    ...

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: customization search sales line gridview

    Anyway the code for finding a matching sales line would be something like this. No guarantees, it's just an illustration, your homework is to finalize it :)

    public SalesLine findByBarcode(SalesId _salesId, ItemBarCode _barcode)
    {
        SalesLine salesLineLocal;
        InventItemBarcode inventItemBarcode;
        
        select firstonly salesLineLocal
            where salesLineLocal.SalesId == _salesId
            exists join inventItemBarcode
            where inventItemBarcode.ItemId == salesLineLocal.ItemId
            && inventItemBarcode.InventDimId == salesLineLocal.InventDimId
            && inventItemBarcode.ItemBarcode == _barcode;
            
        info(strFmt("Match found, line number %1", salesLineLocal.LineNum));
            
        // Or, if you want to find out the number of matching records:
        select count(RecId) from salesLineLocal
            where salesLineLocal.SalesId == _salesId
            exists join inventItemBarcode
            where inventItemBarcode.ItemId == salesLineLocal.ItemId
            && inventItemBarcode.InventDimId == salesLineLocal.InventDimId
            && inventItemBarcode.ItemBarcode == _barcode;
        
        info(int642str("%1 matching records found", salesLineLocal.RecId));
    }

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: customization search sales line gridview

    Hi mohammad,

    did you notice that the error part is from your own code that you shared in your initial message. Perhaps you forgot to share the full code - and therefore also our suggestion can only be partial?

  • mohammed.mqi Profile Picture
    mohammed.mqi 2,016 on at
    RE: customization search sales line gridview
    [quote user="Gunjan Bhattacharyya"]

    Hi mohammed,

    Where are are searching by barcode? Also what error are you getting?

    Looking at your code, are you trying to loop through all sales order lines? In that case you an try this code -

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    salesLine_ds = _salesLine.dataSource();
    localSalesLine = salesLine_ds.getFirst(true) as SalesLine;
    if (localSalesLine)
    {
    while (localSalesLine)
    {
    localSalesLine.SalesDeliverNow += 1;
    localSalesLine = salesLine_ds.getNext() as SalesLine;
    }
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Not sure if you are trying to update the record as well in which case you will need include the update statement as well.

    [/quote]

    i'v try your code but it's give me error as you see here

    pastedimage1602681561643v1.png

  • mohammed.mqi Profile Picture
    mohammed.mqi 2,016 on at
    RE: customization search sales line gridview

    yes but here i'll add more condition if there's duplicate line of barcode like check on qty for example 

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: customization search sales line gridview

    So, first you need to know which item has this barcode.

    Then you need to find all sales order lines (on the selected sales order) that have this item.

    And finally you need to adjust the "DeliverNow" for all such order lines.

    Correct?

    So if you have 20 lines that all have the same item and barcode, you want to adjust the DeliverNow value of all these lines?

  • mohammed.mqi Profile Picture
    mohammed.mqi 2,016 on at
    RE: customization search sales line gridview

    sorry for my explain was not very well  

    this is in sales order lines

    i'v create that editstring (in yellow selection) to use it for search and find product by barcode from sales line and if it found any barcode i want it change the value of (delivery now) from line which it found directly

    here in this method

    pastedimage1602680114648v1.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans