visNetwork selectedBy (visOptions function) for multiple columns - visnetwork

I have written code for a visNetwork network. Within the visOptions function, it can currently select node by id (using nodesIdSelection) as well as select nodes using values from a particular column (using selectedBy). I have looked through the documentation to see how to select nodes using additional columns (i.e. multiple drop down lists in HTML) but can't find the syntax.
Any help would be much appreciated.

try to use the DataSet get method with your prefered options.
then you can select the returned array to select your nodes.

Related

How to retrieve specific value from LIST using SELECT

I keep retrieving the entire LIST of Customer's Total Amount instead of the Specific Customer. I have tried using SELECT according to their Order ID to filter out other Customer. However, the result is still the whole list.
My code here
I have tried to FILTER using Customer Name and Order ID. However, the outcome is still the same, returning the entire LIST of Total Amount.
If you reference connect your line items to your order, app sheet will natively create a reverse reference on the order table that contains a list of all of the corresponding line items for that order.
The list that you're looking for lives in the data inside that column. To get the data out you need to do a list the reference, which will extract the value of whatever column you specify out of that reverse reference, creating a list of the values you want from those child records.
Then if you wanted to create a total for all of those line items, you could wrap that list dereference in sum().
References are the key to making just about everything advanced work inside app sheet, definitely worth wrapping your mind around.

Generic itab in JOIN in SELECT?

I have a generic table in global area and i want to use it in SELECT from. Is this possible or is there a way do this ?
Example Code:
FIELD-SYMBOLS: <gt_data> TYPE STANDARD TABLE.
CLASS-DATA: mo_data TYPE REF TO data.
CREATE DATA mo_data LIKE lt_data.
ASSIGN mo_data->* TO <gt_data>.
<gt_data> = lt_data.
SELECT data~matnr,
mbew~malzeme_deger
FROM zmm_ddl_mbew AS mbew
INNER JOIN #<gt_data> AS data ON data~matnr EQ mbew~matnr
INTO TABLE #DATA(lt_mbew).
If the Generic table you are asking about is an internal Table which the code snippet suggests, then
No i dont think you cant build a join to work on 2 different sources.
Unless there are some new kernel developments, the select statements are converted to DB SQL statements.
ABAP 7.5 documentation of Select statement refers to the from "data_source" as dbtab,View or cds_entity as possible sources.
Even if it was possible there are still other generic options that may make more sense. If the source internal data is small enough, then you can build a generic where clause to solve the problem.
Select from DBTAB where (string_cond).
If the size of the internal table is so large that you end up with half the data in memory and half on a DB, there may be a better generic solution anyway.
No, it is not possible. From the SELECT datasource help:
If the FROM clause is specified statically, the internal table cannot be a generically typed formal parameter or a generically typed field symbol. Objects like this can only be specified in a dynamic FROM clause and must represent a matching internal table at runtime
The above rule remains valid whether itab joined with dbtab or not.

Using #query on CrudRepository(Spring data jdbc) with table join

I am trying spring data jdbc with #query and I met a question: If I have a query that joins 2
tables like this:
#Query("select a.*, b.* from master a, detail b where b.master_id=a.id and a.id=:id")
How do I get the response?
The official Spring Data JDBC, References, and Aggregates didn't give any hint on it.
Any suggestion?
You have multiple options:
Use the default RowMapper
Use as the return type a class (or a collection of that class) that has properties for all the fields you are selecting.
This will return a single element for each row.
Since you are referring to the two tables as master and detail you probably don't want that in this case.
Use a custom RowMapper
The #Query annotation allows you to specify your own rowMapperClass which will get instantiated and passed to a NamedParameterJdbcTemplate together with your query.
Again this will result in on result element per row selected and therefore probably isn't what you want.
Use a custom ResultSetExtractor
This can be again specified in the #Query annotation.
And allows you to construct the result in an arbitrary way.
See the documentation for ResultSetExtractor for more details.
Remark: If you are using a ResultSetExtractor to create a single Master with multiple Detail instances from multiple rows of your query result make sure to add an ORDER BY master.id. Otherwise the order of rows is likely as desired but actually not guaranteed.

How to build "if statement" in SPSS Modeler?

could you please advise how to build "if statement" in SPSS Modeler if we have two data sources?
One data source (1) is a table (an output node generated by SPSS Modeler) where all the IDs are listed with which we need to work further.
Another data source (2) is an Excel file where all the IDs are listed whereas this list includes some IDs from (1) but also some additional ones - to all these IDs are assigned values that are needed to be added to the data source (1) not necessarily to the table.
So if the ID from (1) is in (2) we would like to assign a value from (2) to the ID in (1) and have it stored in some table or even better in a file.
Thank you very much for your help / advice.
Patricia
Based on your problem it sounds like you want to merge these datasets. This can be easily done in Modeler via the Merge Node, just make sure the variables have the same name or Modeler won't recognize it as a key. You can see an example here
You can also create a flag variable using the Derive node, see example here
You will have to use the Merge Node to combine the 2 datasets but you don't have to give the same name for the keys IDs. You can use the option condition in the Merge Node without the necessity of having the same name and even the same type of variable.
Syntax example for the merge Node - option condition: 'ID' = 'id'

Fetch data from multiple tables and sort all by their time

I'm creating a page where I want to make a history page. So I was wondering if there is any way to fetch all rows from multiple tables and then sort by their time? Every table has a field called "created_at".
So is there any way to fetch from all tables and sort without having Rails sorting them form me?
You may get a better answer, but I would presume you would need to
Create a History table with a Created date column, an autogenerated Id column, and any other contents you would like to expose [eg Name, Description]
Modify all tables that generate a "history" item to consume this new table via Foreign Key relationship on History.Id
"Mashing up" tables [ie merging different result sets into a single result set] is a very difficult problem, but you would effectively be doing the above anyway - just in the application layer, so why not do it correctly and more efficiently in the data layer.
Hope this helps :)
You would need to perform the sql like:
Select * from table order by created_at incr
: Store this into an array. Do this for each of the data sources, and then perform a merge sort on all the arrays in Ruby. Of course this will work well for small data sets, but once you get a data set that is large (ie: greater than will fit into memory) then you will have to use a different collect/merge algorithm.
So I guess the answer is that you do need to perform some sort of Ruby, unless you resort to the Union method described in another answer.
Depending on whether these databases are all on the same machine or not:
On same machine: Use OrderBy and UNION statements in your sql to return your result set
On different machines: You'll want to test this for performance, but you could use Linked Servers and UNION, ORDER BY. Alternatively, you could have ruby get the results from each db, and then combine them and sort
EDIT: From your last comment about different tables and not DB's; use something like this:
SELECT Created FROM table1
UNION
SELECT Created FROM table2
ORDER BY created

Resources