Set Order for a Table (Laravel) - laravel

I using laravel 5.1 and PostgreSQL.
I have data product, and I want to custom the order by myself.
For example, I have product
{A, B, C, D, E, F}
and I want to show them in a table by what I want
Idx | Item
-----------
1 | A
2 | C
3 | E
4 | B
5 | F
6 | D
To do this I need a page that can setting it right?
My problem is I don't know what page must I develop to create setting order.
Maybe a page that has a table that I can move each row to set the order,
and a database field in item table to save the order setting?
Please someone help me, is there a plugin like that?

You can just create a page that list all items with minimal amount of information. Then you change the order use something like jQuery UI sortable or Dargsort to sort them, and then save the index of the list back to your database as custom index
But keep in mind 100 items is still too many, it would be much better to just provide filter of all attributes to display items in different order.

Related

Perform an OR operation on same field from multiple rows SSRS

I am a beginner trying to achieve a simple operation in SSRS using Visual Studio 2019. I have a query which returns a table as follows
ID | Name | Married
1 | Jack | Y
2 | Jack | N
The number of records might vary depending on the number of results. On the report, I want to display only the field 'Married' once. The value of the field will be determined using an OR operation, i.e. if the field 'Married' is 'Y' for any one record, I want to display a 'Y' on the report.
Assuming the Values are either Y or N, you should be able to use something like
=MAX(Fields!Married.Value)
If you report is grouped by, for example, Name then this will give you the MAX value within each group which is probably what you want.
If this does not help, edit your question and show
Your report design
Row Group panel plus details of grouping
A larger sample of data
Expected results from that sample data

Creating advanced SUMIF() calculations in Quicksight

I have a couple of joined Athena tables in Quicksight. The data looks something like this:
Ans_Count | ID | Alias
10 | 1 | A
10 | 1 | B
10 | 1 | C
20 | 2 | D
20 | 2 | E
20 | 2 | F
I want to create a calculated field such that it sums the Ans_Count column based on distinct IDs only. i.e., in the example above the result should be 30.
How do I do that?? Thanks!
Are you looking for the sum before or after applying a filter?
Sumif(Ans_Count,ID) may be what your looking for.
If you need to always return the result of the sum, regardless of the filter on the visual, look at the sumOver() function.
You can use distinctCountOver at PRE_AGG level to count unique number of values for a given partition. You could use that count to drive the sumIf condition as well.
Example : distinctCountOver(operand, [partition fields], PRE_AGG)
More details about what will be visual's group by specification and an example where there duplicate IDs will help give a specific solution.
It might even be as simple as minOver(Ans_Count, [ID], PRE_AGG) and using SUM aggregation on top of it in the visual.
If you want another column with the values repeated, use sumOver(Ans_Count, [ID], PRE_AGG). Or, if you want to aggregate via QuickSight, you would use sumOver(sum(Ans_Count), [ID]).
I agree with the above suggestions to use sumOver(sum(Ans_Count), [ID]).
I have yet to understand the use cases for pre_agg, so if anyone has concrete examples please share them!
Another suggestion would be to do a sumover + partition by in your table (if possible) before uploading the dataset, then checking if the results matche with Quicksight's aggregations. I find Quicksight can be tricky with calculated fields, aggregations, and nested ifs so I've been doing calculations in SQL where possible before bringing it in to quicksight to have a better grasp of what the outputs should look like. This obviously is an extra step, but can help in understanding how quicksight pulls off calcs and brings up figures (as the documentation doesn't always give much), and spotting things that don't look right (I've had a few) before you share your analysis with a wider group.

Filter report filter in ServiceNow

In the built-in, classic report UI, people can pick columns to filter on. We want to limit what entries show up in these columns, based on another column. Like...
Foo | Bar
A | 1
B | 2
C | 3
D | 2
E | 2
I want them to be able to filter on "Foo", but only if "Bar" is 2. So I only want B, D, and E to show up. I've tried ACLs on the table, business rules, UI policies, and while they can prevent records from showing up in the results, they don't seem to touch the options available in the report filter dropdown. So to be clear, the results are perfectly fine. Those are filtered. But I don't even want them to see the other options in the filter dropdown.
Is this even possible? On ServiceNow Jakarta at the moment, moving to Kingston soon.

SSRS / Visual Studio: Distribute data into columns based on another field

Is it possible to easily distribute data ('subject's in my case) into different columns based on the value of another field ('block' in my case) so I could have a kind of timetabling grid report, i.e.
if my data looks like:
Subject | Block
----------
English | A
French | B
Science | C
----------
x | A
y | B
z | C
How might I produce a table / matrix that looks like:
Block A | Block B | Block C
English | French | Science
x | y | z
(forgive the formatting!)
I can't help thinking this must be straight forward, but I can't seem to find the appropriate technique. Something like a pivot, but listing rather than aggregating values? I thought maybe filtered columns, but that doesn't seem very efficient. Many thanks for any advice!
Using the following as a basis
https://stackoverflow.com/a/9007678/2311633
(I have copied the relevant sections so the complete answer is on this page...)
You can create a horizontally expanding table by:
First create a Tablix by dragging the Matrix Report Item onto the design surface. The Tablix will have a RowGroup and a ColumnGroup by default.
Delete the Row Group by right clicking on it and selecting "Delete Group" In the Delete Group prompt, delete both just the group. (Not related rows and columns; you'll probably want these as left label for your rows.)
At this point right click the Column Group and "Add Group -> Child Group...". Keep adding child groups for each of the rows you require. For each child group select 'Group by' and choose each of the series you wish to display on each individual row.
I am unable to post images at this time, but have been able to recreate what you have requested above. Once I'm able to I'm can post screenshots for further clarification if required.
Update
Alternatively, If you are able to edit the SQL source could you add another field to define a row number for each item. Using ROW_NUMBER() and PARTITION_BY you could add a new column such as
SELECT ROW_NUMBER() OVER(PARTITION BY [Block] ORDER BY [Block]) as rownum
Then you could just create a simple Matrix as shown here https://www.flickr.com/photos/135805284#N08/20883237722/

Multi-sort Media Wiki Tables

I am trying to allow sorting a wiki table that use the "sortable" class by multiple columns.
Eg:
{| class="wikitable sortable"
|-
|Col 1
|Col 2
|Col 3
|-
|3
|a
|tee
|-
|2
|c
|hot
|-
|5
|b
|apple
|}
That will give you a basic sortable table on the wiki, but it won't let you sort by multiple columns.
Does anyone know of a way to do this or of an extension I can install that will allow me to do this?
Wiki sortable tables seem to already give the ability to multi-sort tables natively / without extension.
After clicking the first column to be sorted, press and hold shift key then click on other column headings for the next columns to be sorted. (Reference 1 2)
I am not sure this function is already there when this was asked, but this StackOverflow question seems to pop on search results more often than the article itself.
You can find any JavaScript code on the web for sortable tables and put that code in your user JavaScript or site Javascript. This simple one works because somebody has already added code for single column sortable tables which looks for tables of class "wikitable sortable".

Resources