How to make conditional search in a specific table column of which values not saved in database?

How to make conditional search in a specific table column of which values not saved in database?

sam3728sam3728 Posts: 2Questions: 1Answers: 0

We are fetching values from multiple tables. All we have 10 columns and there is one last 10th column which values getting from the calculation of 8 &9 column.
We want to show rows only have result greater than "0" in 10th column.
or
we should able to search greater than 0 value rows.

Currently we able to search column values which already stored in database table. Not able to search dynamically calculated values .
Please help with better solution as we have 1 lac+ rows records.

Answers

  • kthorngrenkthorngren Posts: 20,275Questions: 26Answers: 4,765

    Are you using server side processing? If so your server script will need to perform the filtering based on calculation of columns 8 and 9.

    If not then we will need to see how you are calculating these values and putting them in the Datatable. Please post your code. Better yet please post a link to your page or a test case so we can actually see it running.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • sam3728sam3728 Posts: 2Questions: 1Answers: 0

    Thanks Kevin,
    Please see attached image .
    Short fall qty- calculating by Net available and Reorder level
    Max Level - fetching from database table
    Order to be placed - either short fall qty or max level -> which one is greater

    Here we don't want to show product which have order to placed 'ZERO'
    want show only greater than ZERO items in datatable.
    or
    we should able to search by condition < ZERO

  • kthorngrenkthorngren Posts: 20,275Questions: 26Answers: 4,765

    Not sure I understand but it sounds like you want to use searchCols to perform an initial search of the Datatable to filter out condition < ZERO.

    Kevin

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Another option to Kevin's is just to remove the lines you don't want in the table in an ajax.dataSrc function - the last example in that link is a good starting point.

    If neither of those suggestions help, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.