Determine list of selected partitions on Exact Online - exact-online

When I set the list of active partitions in Data Hub using:
select code
from systemdivisions
where city='Rotterdam'
to all customers in Rotterdam, the next queries will retrieve data across all customers.
In Invantive Control I can see in the GUI which partitions are selected, but this is not visible in Data Hub since it is a command line tool.
How can I determine afterwards which companies have been selected as a partition?

Use the following query:
select code
, label
, short_name
from systempartitions#datadictionary
where is_selected = true
order
by code
to retrieve the currently selected partitions.

Related

Populate ComboBox based on filtered continuous form

I have a table of products, batches and their test results. The user will be selecting a product to view all the tests. A continuous form is displayed with the filtered results.
What I would like is another custom filter in the form header that will list only those batches that are already displayed in the current filter set. For instance if they choose to look at test results for Product X, the form lists all the tests for Product X which may contain many batches...
I would like to have just those batches that are for Product X in the CBObox so the user can select it and see only that set of tests.
From what I have found on the web so far, they seem to be displaying ALL batches and not just those in the displayed record set.
Is this possible and thanks in advance.
Is your database connected to sql server? If so, filter using the where clause in a sql string. If not vba is the answer to filtering based on this results. Do you have any pictures or sample code so I can help you out further. You could also set the record source of the combobox to the query with such filters applied.

Inserting data from one table to another using a macro

I have an MS Access database we're going to use at our swimming pool to scan family passes and log usage.
Currently I have three tables, one for the Family Name and Contact Info (tblFamilyPass), another for First Names, Photos, and a unique barcode (tblPassHolders), and a third which logs usage (tblCheckIn).
I have one query that selects the Surname, Phone# and Address from tblFamilyPass that I use to create a relationship between tblPassHolders and tblFamilyPass and associate individuals with their respective Family Pass, and I'm using a form that uses a macro to scan barcodes and filter through tblPassHolders to show the record that corresponds to the barcode.
I have another query that grabs the First name and Family name from tblPassHolders that I'm using in tblCheckIn, which only has two fields: The First/Last name of the individual, and the time they check in.
Now what I'm trying to do, is modify my macro so that each time I scan a barcode, it adds a new record to tblCheckIn.
I'm pretty new to Access, so I'm still doing everything with the macro builder. So far I've only managed to get the table open and select a new record. But my attempts at using SetValue:
Returns the error:
The object does not contain the automation object 'tblCheckIn'
Inserting the time should be the easy part, my efforts to insert the name of the individual have been even less successful.
How do you insert data into one table while browsing data from another? Will I be able to insert two fields into tblCheckIn from a tblPassHolders form using macros?
Using the Macro Builder didn't work out, the solution that worked was the following bit of code using the code builder rather than the macro builder:
DoCmd.OpenForm "CheckIn"
Forms!CheckIn![PASSHOLDER] = Me![BARCODE]
Forms!CheckIn![CHECKINTIME] = Now()
DoCmd.GoToRecord , , acNewRec
There is a point where you have to move past relying on the macro builder.

Identify row index of specific row within dataset by reference to the principal key

I have a table "documents", with an id column, which is the principal key. The table has numerous other fields and users can view the table sorted by reference to many of these fields. The table data is displayed within a virtual tree control which requests only the data it requires for the current client area of the tree.
Say my document table had the following structure and data (it doesn't, but the simple eg below is hopefully suffucient to illustrate)
id description date_of_doc
----------------------------------
1 Doc 1 10/05/1987
2 Doc 2 11/06/1988
3 Doc 3 12/07/1989
4 Doc 4 13/08/1990
5 Doc 5 14/09/1991
6 Doc 6 15/10/1992
My virtual control loads the date in id order is as per the default table order.
However, the control allows you to click on headers which are called "description" and "date_of_doc". Clicking on these headers changes the order in which the data is displayed in the control. Click the same header twice and it will sort descending. I issue a new query to get the data with an "ORDER BY" command depending on what header has been clicked.
So if I am sorting by date_of_doc and it is descending then the new position of id 2 is in fact 5. Having sorted my user then clicks on the "Find by ID" link to find the document with the id "2". I now need to take him to the correct node within my tree control to find this document. From the simple dataset above we can work out that the new index of this position within the tree is 5. But how do I do that with a query taking into account the Order by clause.
Currently I am selecting the id field for every row in the table using the same Order by and then iterating through the query result until I can match the document id with the id requested by the user. There is nothing wrong with this query in the sense that it gets me the correct position, it just strikes me as grossly inefficient especially as I need to work with large tables.
What I am looking for is a query which is something like
SELECT row_num FROM documents WHERE id=12345 ORDER BY date_of_doc
However, the control allows you to click on headers which are called
"description" and "date_of_doc". Clicking on these headers changes the
order in which the data is displayed in the control. Click the same
header twice and it will sort descending. I issue a new query to get
the data with an "ORDER BY" command depending on what header has been
clicked.
This is not very efficient as it needlessly hits the DB everytime someone tries to sort columns. You can retrieve data once per usersession and either cache the data on the Web Servers Memory and sort it in memory. Or use some client side sorting techniques using many javascript libraries ... Iam not an expert on these techniques but you should be able to find help on this topic as it is a very common scenario. Also you haven't mentioned what technology stack you are using to build your web app. C# asp.net, java , php, etc ...
So assuming that we are sorting in memory the only other call to the db would be to fetch the document for the particular requested document.
That said for your immediate need to avoid iterating rows to find
To do that you can write a Stored procedure that takes the DocID and returns the recordset like so ( just pseudocode may need to tweak it for your actual scenario ) :
Create GetDocDetailsByID
(
#id int
)
Begin
select id, description, date, ....
from yourtablename
where id = #id
End
You should have that doc id in your application at run time when the user performs a button click or hits a hyperlink. Call the above SP with that ID. this part is platform specific. So let me know what is your front end platform and we can see if that needs tweaking.

Customize Mysql DB fetch in Office Excel

I am able to fetch a sql query from excel using the odbc connection:
But the issue is that, instead of just give a stack query setup and make user can only click the refresh button, I wish I could have some fields before the result, which user can enter some custom variables(e.g date from, date to)
so when they click refresh button, excel will take the variables of what user inputted into the pre-defined sql query and fetch the result from my sql server.
To do this sort of thing you need to run one query to fetch the initial values of your custom variables from the DBMS. For example, if you want to let the user change the date range, do this.
Use a query fetch the minimum and maximum date from the date column of your table.
SELECT MIN(date) mindate, MAX(date) maxdate
FROM table
Display those dates and let the user edit them on your form.
Put the results of those edited items into your second query, and retrieve the data the user asked for.
SELECT (whatever)
FROM table
WHERE date BETWEEN user-min-date AND user-max-date
The same kind of steps will work to populate a dropdown or listbox with a category
SELECT DISTINCT category
FROM table
ORDER BY category
Then
SELECT (whatever)
FROM table
WHERE category = user-selected-category
I think this addresses your question. Please clarify if it doesn't.

Access Form Field Logic

I'm trying to make access conditionally only show rows that meet a certain condition, allow me to give you some background info before I proceed :
I've created an Access form and linked it to a test DB on my machine. The particular table I am interested in contains the following (important) rows :
ID , Office, Name, SecurityNumber
The thing is, ID is not unique. There are two Office locations, and each Office has it's own set of unique ID numbers. This means that ID 10 here and there may or may not be the same person. (this data comes out of a legacy security system we're not looking to change yet, so I cannot change it)
But ID -is- unique to each Office.
SO! I created an Access form with TABS! Two tabs, one for each office. What I am trying to achieve now is :
Have the ID/Name/SecurityNumber fields for each tab populate with only rows that match it's particular 'Office' value.
Thank you for reading and thank you for helping! :D
If you want the data for the office locations presented in separate tab page controls, you could use subforms on the pages which differ only in the WHERE clause of the queries used as their record sources. So for the Office1 subform, the query could be:
SELECT ID, Office, [Name], SecurityNumber
FROM YourTable
WHERE Office = 'Office1'
ORDER BY [Name];
Then for Office2, the query would be the same except for the WHERE clause:
WHERE Office = 'Office2'
As I understand your question, that approach would do what you're asking for.
However, that's not really the easy "Access way" to do it. Instead consider a combo box control to allow your users to choose which office they want to view. In the code for the combo's after update event, either modify the SELECT statement used as the form's record source or create a filter expression an apply it.
Also, since you're pulling the form's data from SQL Server, consider whether you want your form to load every record for the selected office location. It may not be much concern if you have only a few to moderate number of rows for each location, but if you'll be dealing with multiple thousands of rows it could be. In general, you should try to avoid pulling copious amounts of data across the wire; pull sparingly instead ... only what you need for the immediate task at hand.