Check serverside leftjoins
Check serverside leftjoins
in Editor
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
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
Just to add to that:
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
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?
Do you have the raw SQL for what you want? If so, can you show me that?
That sounds like a regular left join. In this example I've got it reading just
namefrom the joined table, but you could readily have it read multiple fields if you want from the joined table.Allan
In this part of the code, I create a field depending on the Mapping object, which describes the relationship (with another table or simply an enum of values created by the administrator).
This is how you describe a field that references another table. As you can see, I don't know the values in advance, whether there is mapping, and what type they are. There may be several such mappings.
The problem is that I need to create aliases for values from another table, since I don't know how many references there will be to the same table. Therefore, I would like to know if it is possible to see which tables have already been added.
As a result, I would ideally like to see a list of already joined tables so that I don't have to create a new join, but change the condition. Or should I make my own decision - find out what the mappings will be and connect all the conditions manually in a string, and later add a left join, already knowing how many tables there will be, and add strings for the conditions to the conditions.