Start a new page in a jQuery DataTable based on a cell's value - datatables

How to start a new page in a jQuery DataTable based on a cell's value?
Say i have two customers and the JSON result returns 50 records from database. I need the DataTable to show this record order by customer number separated, the table must start a new page and show customer num2 data.

Related

how to calculate the difference between the sum of each column from different datagridview and to show it in a datagridview

Hello I am a student in computer science , we ve got a inventory system project to do.
I have a problem
using sql I know how to importe sql to datagridview. I know have to save data in sql database using vb
but I still don t know how to calculate the difference of sum of each column from each different datagridview and to show it in datagridview.
My gol is:
I have a datagridview1 that shows the quantity of purchsases of a product in column A.and I have another datagridview2 that shows the quantity of sells of the same product in column B.
Datagridview1 is on form1.vb.
datagridview is on form2.vb0
what I want is : to calculate and view the stock the stock still available on new form3.vb on datagridview3.
thanks in advance
You need to follow the following steps (For selected Row):
Dim Data1 As String = GridView1.SelectedRow.Cells(Column Number).Text
Dim Data2 As String = GridView2.SelectedRow.Cells(Column Number).Text
Data1 - Data2
Save the result in a new table (database)
Show the new gridview3
Repeat for all rows.

SSRS Query result in one cell based on other cells in the same row

Have not yet had to do this in SSRS and I'm scratching my head.
Basically, I have a tablix based on DataSet 1. The tablix is sorted and grouped on a field called AssemblyName and it is also the first column value. The second column value is based on the sum of a field called Quantity. (in the database table, each row has an AssemblyName value and a Quantity value)
The tricky part is this: There is another table in the database that contains a 'snapshot' of the AssemblyName and Quantity based on older (original) data.
And in my Tablix I want to show a cell in the same row that Sums the old Quantities for the AssemblyName in the first cell of the row. The old Quantities would be pulled from the database table with the old data.
Basically, the goal is the show a Tablix grouped and sorted by AssemblyName, and have the following columns in the tablix: Assembly Name (from current DB table), the current Quantity sum (from current DB table), and the old Quantity sum (from another DB table with the old data).
I have everything working except for the cell that contains the old Quantity sum from the old DB table.
The old DB table is in the same database, so that is not an issue, what my problem is, creating a query that sums the Quantities in the old table based on the value of the AssemblyName in the same Tablix row.
I've tried creating Dataset 2 with a query based on parameters pulled from Dataset 1, and then writing this expression in the old quantity cell:
=Sum(Fields!Quantity.Value, "Dataset 2")
I'm getting blank values in every cell in the third column, which contains the expression above. I'm assuming it because the Dataset 2 is not actually reading the values of AssemblyName in the same tablix row. The essence of what I want to do, however, is pass the value from the first column in the tablix, which contains AssemblyName, to the WHERE clause in the query for Dataset 2 whose parameter is in turn shown in the third column's cell in the same tablix row.
In case it helps, the query from DataSet 2 is as follows:
SELECT AssemblyName
, Quantity
FROM OldData
WHERE AssemblyName = #compare_AssemblyName
I hope this makes sense, but please ask questions as needed so that I can clarify.
Regards.
You should be able to pull the old data in along with your new data in the same query, then just sum the respective fields:
SELECT AssemblyName
, NewQuantity = n.Quantity
, OldQuantity = COALESCE(o.Quantity, 0)
FROM NewData n
LEFT JOIN OldData o
ON n.AssemblyName = o.AssemblyName
WHERE n.AssemblyName = #compare_AssemblyName

How to create calculated column with data from another list

I have the following situation: List A has two columns (Name, Amount) and in List B (Name) I want to add a calculated column which should be the sum of all entries in List A that have the same name as in List B. Example:
List A:
NAME Amount
L0011 100
L0011 50
L0020 234
So in List B I want the calculated column to show:
NAME Amount
L0011 150
L0020 234
How can this be done? Workflow (as soon as I add/mod an entry in List A, update List B) or something else? Thanks
lem.mallari's answer is a huge pain unless you can assume that the Amounts in List A never change, since it's not tracking whether an item has already been added to the sum. There is no way for a Workflow to iterate through a SharePoint list, which means there is no easy way to calculate the sum or average of multiple list items.
The correct way to implement this will will require some development. The SharePoint Developer Training (2010, 2013) will actually get you most of the way there: an event receiver should trigger when items are added or changed in Lists A and B that uses SharePoint's API to go through List A and average values by Name, then update all (or just affected) items in List B. Alternatively, you can use JavaScript to display the sum of all entries in List A that have the same name as the item in List B as long as all the data is displayed on your page. If you're handy with XPath and InfoPath, you could add List A as a secondary data source to List B's form and select only applicable items in List A to sum from.
But if we're talking Workflows, here's the "workflow only" method. This was tested and successful in 2010. Create custom List C with the following columns:
Title (string, mandatory, enforce unique values)
TotalItems (integer, mandatory, default 0)
Sum (number, decimal places however you want, mandatory, default 0)
Average (calculated, =IF(TotalItems=0,0,Sum/TotalItems)) (optional)
Replace the Name columns in Lists A and B with lookup columns pointing at List C. Delete the Amount column in List B, instead including the Sum column as an additional column. Add the following columns to List A, and ensure that users cannot change them directly. This can be restricted by making InfoPath forms or by making alternative view and edit forms.
AmountArchive (number, identical to Amount, default 0)
AmountHasBeenSubmitted (yes/no, default no)
Create a Workflow to run each time an item is created or modified in List A. Use these commands (I'm using a list for readability; it was getting ugly when formatted as code):
If Current Item:Amount not equals Current Item:AmountArchive
Set Variable:Item Count to (Data source: List C; Field from source: TotalItems; Find the List Item: Field Title; Value: Current Item:Name(Return field as: Lookup Value (as Text)))
Calculate Variable:ItemCount plus 1 (Output to Variable: ItemCount)
Calculate List C:Sum (similar settings as above; be sure to use Lookup Value (as Text) and not String!) minus Current Item:AmountArchive (Output to Variable: SumWithoutValue)
Calculate Variable: SumWithoutValue plus Current Item:Amount (Output to Variable: NewSum)
If Current Item:AmountHasBeenSubmitted equals No
Set AmountHasBeenSubmitted to Yes
Update item in List C (Set TotalItems to Variable:ItemCount; Set Sum to Variable:NewSum; Find the List Item in the same way of Field:Title; Value: Current Item:Name(Return field as: Lookup Value (as Text))
Else
Update item in List C (don't do anything to TotalItems; use the same logic to set Sum to Variable:NewSum)
Set Amount to Current Item:AmountArchive
This can't be done using calculated columns because calculated columns can only be used for columns on the same list.
Using SharePoint Designer Workflows you can just use Create List Item and Update List Item actions so that whenever a user adds a value for L0011 the amount will be added in another list's column which contains the previous amounts already.
Let me know if you need a more detailed answer for the SharePoint approach and I'll provide you a step by step instruction on what to do.
What about using the DSum function? https://support.office.com/en-us/article/DSum-Function-08F8450E-3BF6-45E2-936F-386056E61A32
List B
NAME Amount
L0011 =DSum("[Amount]","List A","[NAME]=''" & [NAME] & "'")
L0020 =DSum("[Amount]","List A","[NAME]=''" & [NAME] & "'")

Datatable Compute Method filter on row number

I use a query which fetches say 50 records and passes it to a datatable. This record is then displayed in a tabular format. The display has pagination used displaying 10 records at a time. There is a facility to move to next or previous set of record or move forward or backwards by 1 record.
I have to find Min and Max of a column for the set of record currently visible. I am planning to use Compute method but I am not sure if it allows filtering on anything other than the columns in datatable.
Do I have to include row number in my query or is there a better solution (something along the line mentioned below)?
CType(dtLineup.Compute("Min(ArrivalDate)", dt.row(2) to dt.row(12)), Date)
There is nothing like your pseudo code in MSDN on DataColumn.Expression. You could include a row number in your query, as you said, but an alternative is to add a row number column to your data table and use that in the filter expression.
DataColumn col = new DataColumn("rownumber", typeof(int));
col.AutoIncrement = true;
col.AutoIncrementSeed = 1;
datatable.Columns.Add(col);
Another alternative could be to do paging by linq (Skip-Take) and compute the aggregate function over the returned rows. But that may be a major departure of your current application structure.

one problem in fetching a data from backend in vb.net

i have two item in form it is---1 is textbox and 2nd is combo box.
now i have single value in textbox .
but there is a multiple value for a combobox with is totally depend on a value of textbox....
*i am already add data to the backend files ... in which 1 columns that is called column A it's value is for textbox and 2 column that is called column B it's value for combo box *
When i write in textbox it's dependent ALL value can be get in the combo box.
Can any one solve my problem... It is a row vice search.....
I used a Ms Access for my backend......
How i can create a table that can be i used for a my problem
Give me any reference or codes.
This is probably Category->Product kind of scenario, where ONE Category can have ONE or MORE Products,
Category "Softdrink" can have Products("Coke","Pepsi" etc.)
Category "Harddrink" can have Products("8 PM","BP",etc.)
So when u will put "Softdrink" in your textbox then you want to get the relevant products for it. (Assumed you are using TextChange event)
SQL - select Product.Name from Category Inner Join Product On Category.Id= Product.Category_Id where CategoryName ="Softdrink"
and table structure would be like,