When I make a query in BusinessObjects and when two tables are inner-joined, the BO generates the following script:
SELECT
attr_1,... attr_N
FROM Table_1, Table_2
WHERE Table_1.key = Table_2.key
Is it possible to set BusinessObjets to generate queries in the following format:
SELECT
attr_1,..., attr_N
FROM Table_1
INNER JOIN
Table_2
ON Table_1.key = Table_2.key
When I want to check the query, it is much more easy to read the syntax in the second example.
Btw, I tried to modify some parameters. However, it didn't work.
Any suggestion on how to do it quickly and easily?
Assuming you're on XI3...
In Designer, go to File -> Parameters. Then click the Parameter tab. In there you should see a parameter named "ANSI92"; change its value to Yes and click Replace.
In BI4 IDT, first open the universe's Data Foundation. Then click on the .dfx file in the Data Foundation pane to select it:
This will bring up the Data Foundation settings in the lower right corner of the window. Click the Properties tab, then the Parameters button:
In the dialog that comes up, you can change the ANSI92 option:
Related
Disclaimer: new to SSIS and Active Directory
I have a need to extract all users within a particular Active Directory (AD) domain and import them into Excel. I have followed this: https://www.itnota.com/query-ldap-in-visual-studio-ssis/ in order to create my SSIS package. My SQL is:
LDAP://DC=JOHN,DC=JANE,DC=DOE;(&(objectCategory=person)(objectClass=user)(name=a*));Name,sAMAccountName
As you know there is a 1,000 row limit when pulling from the AD. In my SQL I currently have (name=a*) to test the process and it works. I need to know how to setup a loop with variables to pull all records and import into Excel (or whatever you experts recommend). Also, how do I know what the other field names are that are available to pull?
Thanks in advance.
How do I see what's in Active Directory
Tool recommendations are off topic for the site but a tool that you can download, no install required, is AD Explorer It's a MS tool that allows you to view your domain. Highly recommend people that need to see what's in AD use something like this as it shows you your basic structure.
What's my domain controller?
Start -> Command Prompt
Type set | find /i "userdnsdomain" and look for USERDNSDOMAIN and put that value in the connect dialog and I save it because I don't want to enter this every time.
Search/Find and then look yourself up. Here I'm going to find my account by using my sAMAccountName
The search results show only one user but there could have been multiples since I did a contains relationship.
Double clicking the value in the bottom results section causes the under pane window to update with the details of the search result.
This is nice because while the right side shows all the properties associated to my account, it's also updated the left pane to navigate to the CN. In my case it's CN=Users but again, it could be something else in your specific environment.
You might discover an interesting categorization for your particular domain. At a very large client, I discovered that my target users were all under a CN
(Canonical Name, I think) so I could use that in my AD query.
There are things you'll see here that you sure would like to bring into a data flow but you won't be able to. Like the memberOf that's a complex type and there's no equivalent in the data flow data types for it. I think Integer8 is also something that didn't work.
Loop the loop
The "trick" here is that we'll need to take advantage of the
The name of the AD provider has changed since I last looked at this. In VS 2017, I see the OLE DB Provider name as "OLE DB Provider for Microsoft Directory Service"
Put in your query and you should get results back. Let that happen so the metadata is set.
An ADO.NET source does not support parameterization as the OLE DB does. However, you can apply an Expression on the Data Flow which surfaces the component and that's what we'll do.
Click out of the Data Flow and back into the Control Flow and right click on the Data Flow and select Properties. In that properties window, find Expressions and click the ellipses ... Up pops the Property Expressions Editor
Find the ADO.NET source under Property and in the Expressions section, click the Ellipses.
Here, we'll use your same source query just to prove we're doing the right things
"LDAP://DC=JOHN,DC=JANE,DC=DOE;(&(objectCategory=person)(objectClass=user)(name=" + "a" + "*));Name,sAMAccountName"
We're doing string building here so the problem we're left to solve is how we can substitute something for the "a" in the above query.
The laziest route would be to
Create an SSIS variable of type String called CurrentLetter and initialize it to a
Update the expression we just created to be "LDAP://DC=JOHN,DC=JANE,DC=DOE;(&(objectCategory=person)(objectClass=user)(name=" + #[USer::CurrentLetter] + "*));Name,sAMAccountName"
Add a Foreach Loop Container (FELC) to your Control Flow.
Configure the FELC with an enumerator of "Foreach Item Enumerator"
Click the Columns...
Click Add (this results in Column 0 with data type String) so click OK
Fill the collection with each letter of the alphabet
In the Variable Mappings tab, assign Variable User::CurrentLetter to Index 0
Click OK
Old blog posts on the matter because I like clicks
https://billfellows.blogspot.com/2011/04/active-directory-ssis-data-source.html
http://billfellows.blogspot.com/2013/11/biml-active-directory-ssis-data-source.html
TL;DR: A data flow task "works" when the package runs, but I am unable to view the query when clicking "preview" in the Data flow Source Assistant.
My working theory is that somehow the Source Assistant is unable to get the value of the parameter when previewing. I tried to resolve this problem by use of (iterations) "Parameter" and "Variable" without success. The example shown below use "Parameter".
In an SSIS Data Flow task, I have a Source Assistant with "SQL Command" as its data access mode.
SELECT h.Campus,
h.StudentName,
h.StudentId,
h.EntryDate
FROM dbo.RwsBaseEnrollmentHistory h
WHERE h.Campus = ?;
The question mark indicates a parameter, which I have defined in "Parameters".
In the OLE DB Source Editor, I made sure to map the variable to the parameter.
When I click "Preview" I get an error:
The data in question cannot be shared, but trust me when I say that when I run the package, the query works as intended. It's the inability to preview the query that I'd like to be able to fix.
What do I need to do so that I can preview the query without having to hard-code the parameter value?
I stumbled into a possible answer. It appears to work so far and I haven't been able to break it. If there is a better way of doing this I would love feedback.
This is my resolution:
Create a variable to hold the desired query (like shown in the example above). In this example, I name it EnrollmentHistory.
In the "Expression", click the [...] button and paste the query. Be sure that double-quotes surround the query.
"SELECT
h.Campus,
h.StudentName,
h.StudentId,
h.EntryDate
FROM dbo.RwsBaseEnrollmentHistory h
WHERE h.Campus = '" + # [User::Campus] + "'"
Press the "Evaluate Expression" button and press OK.
Go back to your Source Assistant and select "SQL Command from Variable" as the Data Access Mode and the Variable you just defined (in this case EnrollmentHistory) as the Variable name. You will see that the parameter is correctly resolved in the Variable Value.
There is an existing Access program that I need to learn more about. There is a button in the program that, when pressed, outputs an Excel file. It queries some tables within it for the data.
How would I view the raw SQL code that this button utilizes to generate this Excel file? From the button's properties, I can see that its On Click event is "[Embedded Macro]". Also, it's object type is "Query".
Thank you in advance.
In the On Click row (under the Event tab in Properties), when I click on the ellipse next to "[Embedded Macro]", I am presented with an expandable section containing these rows:
Object Type - Query
Object Name - Inv File Query
Output Format - Excel Workbook (*.xlsx)
Output File - (blank)
Auto Start - No
Template File - (blank)
Encoding - (blank)
Output Quality - Print
I don't see any logic (SQL, VBA, etc.) listed anywhere, however, as to how Access will construct this Excel file that it exports. How would I view this logic? I figure this logic has to be stored somewhere because the button does actually return an Excel file populated with data.
You have the name of the query used here.
The SQL thus used is in a query called Inv File Query.
So you need to display the query objects in the nav pane (assuming 2007 onwards).
So choose this:
And then all of the queries used in the application will display. If the query Inv File Query does not show, it may be hidden. (to be fair, I would choose All Access objects - but for this we choose query). And hit F11 if the nav pane does not show.
If for some reason you STILL do not see the query, then you want to display hidden objects.
To display all hidden objects then right click on the top part of the nav pane (on the query) like this:
Then:
Turn all of the options, and now you should be able to see/view the SQL used for the query called Inv File Query
Open the form in Design view
Open the Properties sheet by right-clicking on the button and choosing "Properties".
In the On Click event, where you see "[Embedded Macro]", click on the ellipse on the far right
As a pointer, once you've figured out what's going on, I'd do my best to convert it all to VBA code. This will eliminate confusion in the future, and macros are really the poor man's way out of writing code anyway. I never, ever use macros in my Access apps.
I am using SQuirrel SQL Client Version 3.5 and everytime I modify and run a query it opens up a new result tab. I would prefer that it re-use the existing result tab (replacing the contents) Is there a way to do this?
Another way to do this (without having to set the sticky flag everytime) is to set the maximum limit of SQL Result Tabs to 1 in the Global New Session Properties.
You'll find it here: File --> New Session Properties --> SQL Tab
Right click on a result tab and select sticky. This prevents new result tabs from opening.
I am trying to create a form in access that has a dropdown at the top and will populate the rest of the form with the record that corresponds to what is chosen.
I have looked at 2 different guides online but both point to older versions of Access and I think I am missing something.
So. The order that I did everything:
I went to the table for the form. And I clicked Form. This made a quick form with all of the fields as text boxes.
I deleted the field that will be the dropdown and I put in a dropdown canceling the wizard
In the data section for the dropdown. I edited "Row Source" to select the field that will be in the dropdown and the unique ID, in that order.
I set the bound Column to 2 (I have tried both)
I set the name of the Combo Box to "TitleSelector"
In Form Settings. For "Record Source". I have "[forms]![Edit Piece].[TitleSelector] & "*" in Criteria for "ID". I also have the rest of the fields in the Query listed
I added the "me.requery" to on change
Not sure if it means anything. When I was typing in the Criteria for "ID" it did not show "TitleSelector" in the drop down.
I am using Access 2010
Edit:
My Problem -
The dropdown itself shows everything correctly. However nothing happens when I choose something
Edit:
SELECT Pieces.ID, Pieces.Title, Pieces.Composer, Pieces.Instrumentation, Pieces.Location, Pieces.Location_2
FROM Pieces
WHERE (((Pieces.ID)=[forms]![Edit Piece].[TitleSelector]));
Edit:
Here is a link to a copy of my database: https://www.dropbox.com/s/tpnqm686tj653fg/Trisha%20Database.accdb
Adding the me.requery to the ON CHANGE EVENT
(select CODE BUILDER - and enter the me.requery there) should work.
I have downloaded the sample file. Your problem is that the Record Source for the [Edit Piece] form is set to...
SELECT Pieces.ID, Pieces.Title, Pieces.Composer, Pieces.Instrumentation, Pieces.Location, Pieces.Location_2 FROM Pieces WHERE (((Pieces.ID)=[forms]![Edit Piece].[TitleSelector] & "*"));
...and the & "*" at the very end is causing the query to return no records. Removing that last bit so the Form's Record Source is...
SELECT Pieces.ID, Pieces.Title, Pieces.Composer, Pieces.Instrumentation, Pieces.Location, Pieces.Location_2 FROM Pieces WHERE (((Pieces.ID)=[forms]![Edit Piece].[TitleSelector]));
...gets your form working.
Edit
To have your form display information from the related tables (instead of just the foreign key values from the [Pieces] table), change the Record Source of the Form from...
SELECT Pieces.ID, Pieces.Title, Pieces.Composer, Pieces.Instrumentation, Pieces.Location, Pieces.Location_2 FROM Pieces WHERE (((Pieces.ID)=[forms]![Edit Piece].[TitleSelector]));
...to...
SELECT Pieces.ID, Pieces.Title, Composer.Composer, Instrumentation.Instrumentation, Location.Location, Location_1.Location AS Location_2 FROM (Location INNER JOIN (Instrumentation INNER JOIN (Composer INNER JOIN Pieces ON Composer.ID = Pieces.Composer) ON Instrumentation.ID = Pieces.Instrumentation) ON Location.ID = Pieces.Location) INNER JOIN Location AS Location_1 ON Pieces.Location_2 = Location_1.ID WHERE (((Pieces.ID)=[forms]![Edit Piece].[TitleSelector]));