I am a new user in Access. I am trying to use count function to calculate the total records number in my table. How can I use QBE (not sql) to achieve it please?
Thanks.
Drag a field - preferably a unique ID field - into the QBE gid, and click the "Totals" button on the Ribbon Bar.
You'll now see a new row in the QBE called "Total:". This is a combo box- select Count from it, and run the query.
Related
I'm working with web client-GUI-automation testing tool development using selenium-x path-css.
With this webclient, it has a panel area at the lower panel.
Within this panel is a table which has no unique id for its row.
Scenario: When I add a VM through webclient-GUI, on clicking finish button, this lower panel area's table list at its first row that the task has started with
td: taskname, date, target in its row[1] of a table.
In this case if a single task is happening, then this table would have only one row.
So that i can check as
tr[1]td[1] = "Create_Vm" and confirm that the task has started.
But if multiple VM's say:3(vm1,vm2, vm3) are created concurrently, then the table would have
tr[1]td[1]
tr[2]td[1]
tr[3]td[1]
All to be create_vm.
My problem is how do I track a particular task say:vm2 using selenium-xpath-css as there is no unique id for table rowid?
If let's say VM name is in the first column and your desired webelement is in the second column. You can do something like this.
//*[contains(text(),'vm2')]../../td[2]
Find out your column using contains text and then go to it's parent node. And then to your desired column.
if the items are displayed in the order they are started, then do this:
//table//tr[x+1]/td[1]
if in reverse then:
//table//tr[position()=last()+1-x]/td[1]
where x is the vm number.
I am using SQL Server. I have 2 columns Passed students and Failed Students in my database.
How to write a query which displays both these columns along with a third column which is Total Students which displays the sum of the entries in the row?
EDIT
It is not allowing me to ask another question.So,posting it here:
I have a hyperlink field in my gridview as below:
[Please refer comment for the code.For some reason it doesn't get posted here.]
Its basically a runId.When I click on this hyperlink I am redirected to a page called RunAnalysis.I want to access the value of the runId which was clicked in this page.
I was thinking of using query string but there is no event as far as I know that is fired on click of the hyperlink.
My question is how do I access the runId value in this page ? Can someone tell me if some event is fired so that I can send a query string.
Thanks.
You haven't given a lot of background information so I am assuming many things in my response.
Here is a simple aggregated result set:
SELECT SUM(Passed) AS [Passed],SUM(Failed) AS [Failed],COUNT(*) AS [TotalStudents]
FROM dbo.Students
Now if there is some grouping you want to do then you would add a GROUP BY clause like so...
I'm creating a new column because I don't know your schema:
SELECT GradeLevel, SUM(Passed) AS [Passed],SUM(Failed) AS [Failed],COUNT(*) AS [TotalStudents]
FROM dbo.Students
GROUP BY GradeLevel
ORDER BY GradeLevel
I have a form that submits parameters to a query, then opens the resulting record in another form. The problem is, whenever there is more than one record it automatically puts the first one into the from without any kind of option to choose the record I want. I have a macro set up on the search button on the first form that submits the parameters to the query and then displays it in the second form, I've tried to set up another macro in between the two, but I don't know if it's possible to set up the expression creator to check the number of rows resulting from a query. Is it possible to modify the query to create a prompt to choose which record I want? Or should I change something else?
This is the query:(automatically created by access)
SELECT CHILD.CHILD_L_NAME, CHILD.CHILD_F_NAME, CHILD.DOB, CHILD.GENDER, CHILD.DAYS_IN_CARE,
CHILD.HOURS_PER_DAY, CHILD.ENROLLMENT_DATE, CHILD.CHILD_ADDRESS, CHILD.CHILD_CITY,
CHILD.CHILD_ZIP, CHILD.CHILD_STATE, CHILD.CLASSROOM, CHILD.SNACK, CHILD.LAST_UPDATED, CHILD.CIN
FROM CHILD
WHERE (((CHILD.CHILD_L_NAME)=[Forms]![Search]![L_NAME]) AND
((CHILD.CHILD_F_NAME)=[Forms]![Search]![F_NAME])) OR
(((CHILD.CHILD_L_NAME)=[Forms]![Search]![L_NAME]) AND
((CHILD.DOB)=[Forms]![Search]![DOB])) OR
(((CHILD.DOB)=[Forms]![Search]![DOB])) OR
(((CHILD.CHILD_L_NAME)=[Forms]![Search]![L_NAME]));
If I understood well your problem and you use VBA it's quite easy to do.
You can create a reduced query based on the query you're creating with the button. This new query should include all and only the fields that allows you to discriminate beetwen the records to show in the 2nd form.
For instance it could include LastName, FirstName and classroom to select between children with same full name.
You can count the number of records of this 2nd query and if greater than 1 it means that you have more than one children to show.
So you can use this 2nd query to populate a combo-box or a listbox for selecting the record you really want to show.
When number of records is 1 you can simply skip the listbox population using an if statement on recordcount.
Next step is opening the form with the selected (or unique) record.
Bye
I have created a tableA with fields ItemId, Quantity and Price(I have made the display method in tableA's method which returns the price of selected item). I dragged my display method in field groups and I'm using that field group in my form's grid
My question is how to calculate the total sum of selected item's prices and how to show the result in realEdit control?
I will assume you want the accumulated Quantity * Price for your lines.
The easiest way is to store the line amount field on table redundantly and compute it in the modifiedField method.
Then your total field could be a display method:
display Amount total()
{
return (select sum(LineAmount) from TableA where ...).LineAmount;
}
Other solutions are possible such as a computed view field, but this one is a simple no-brainer.
The standard table SalesLine uses this approach as well albeit for other reasons.
That said even simple solutions come to short, if you have thousands of lines, in this case consider caching the total (on entry) then updating manually in write and delete methods.
Have a gridview control which will show X amount of rows. I want to the user to be able to select y number of rows, but limit the maximum selected rows to a set view, such as 3. If the user tries to select a fourth row I don't want them to be able to until they unselect a row.
Anyway to do this?
Thanks
Since the GridView works with single selections, how are you allowing them to select the values in the first place, on the client or server? If on the client, you can use JavaScript to do this; simply store an array of the table rows that are selected, if the length is three, then block adding to the array until the user deselects...
Please update how you are doing it, and I can post further.