Check serverside leftjoins

Check serverside leftjoins

klymov.inekonklymov.inekon Posts: 38Questions: 11Answers: 0

Hi, I have a question about .net editor left joins. In my code I don't know how many and which left joins will be. And can be situations when I need to join same table few times. So I want to check editor already have left joined table. I get the list by editor.LeftJoin(). But I can't see any private field like name of joined table. Can I get this info in code?

Answers

  • rf1234rf1234 Posts: 3,190Questions: 92Answers: 438

    Hmmm. Editor doesn't "make" left joins itself. You have to code them. Looking at your code you should be able to see what left joins you got.

    https://editor.datatables.net/manual/net/joins#Left-Join

  • allanallan Posts: 65,467Questions: 1Answers: 10,874 Site admin

    Just to add to that:

    But I can't see any private field like name of joined table.

    The first parameter of the .LeftJoin() method tells Editor what the joined table name should be.

    But you mention a private property - are you looking to try and access that information externally? Why?

    Allan

  • klymov.inekonklymov.inekon Posts: 38Questions: 11Answers: 0

    It's just that I have a system where I don't know exactly what left joins there will be. And when adding a left join, I pass a string with the table name value. To check, I then need to keep track of the tables that have already been joined, for example, using an array to check if the table has already been added. If it has already been added, then I need to change the join conditions.
    This can be described as working with SQL tables. The user specifies that I have a table with a certain name and certain columns. They want the values for this table to be references to values from another table. For example, in the original table there is a column called customerId, in another table there is a column called customerId, customerName. And I want to see customerName as the result. Such “replacements” can be for several tables and several columns in one table. In order not to join the table twice with different conditions and to avoid conflicts with the join names, I would like to combine them into one join and write the multiple conditions.
    So here's the question: is it possible in DataTables to change these parameters during program execution using the API, or do I need to take all join logic manually first and set a left join function once?

  • allanallan Posts: 65,467Questions: 1Answers: 10,874 Site admin

    Do you have the raw SQL for what you want? If so, can you show me that?

    For example, in the original table there is a column called customerId, in another table there is a column called customerId, customerName. And I want to see customerName as the result.

    That sounds like a regular left join. In this example I've got it reading just name from the joined table, but you could readily have it read multiple fields if you want from the joined table.

    Allan

Sign In or Register to comment.