I want to create a condition in my ant build.xml file where if I set the domainName property is set to Stage, then set the appbox1URL property value to http://10.xxx.xxx.xxx1 and set the appbox2URL to http://10.xxx.xxx.xxx.
However when I run the build.xml file, it does not set the appbox url values. AM I doing something wrong?
<property name="appbox1URL" value=""/>
<property name="appbox2URL" value=""/>
<condition property="appbox1URL" value="http://10.xxxx.xxx.xxx" property="appbox2URL" value="http://10.xxx.xxx.xxx">
<equals arg1="${domainName}" arg2="zzz"/>
</condition>
Use the condition task but you can only set one property per condition (rather than two, as you are trying to set in your OP).
So, split the assignments into two condition instructions:
<condition property="appbox1URL" value="http://10.202.111.111">
<equals arg1="${domainName}" arg2="Stage"/>
</condition>
<condition property="appbox2URL" value="http://10.202.111.112">
<equals arg1="${domainName}" arg2="Stage"/>
</condition>
Related
I am using report builder 3.0 to create reports in a vendor's environment where I only have access to their data sources. We have static data that we need to use in conjunction with the datasets we are creating from their models and I am trying to figure out how to add our data to a report to use for looking up values.
For Example:
The data set has AccountNo, OrderNo, ItemNo, Quantity, etc.
I need to be able to show some attributes about the ItemNo, like ItemName, ItemCost, ItemValue, etc.
I would like to have a dataset I can lookup against to get these values, but the only way I can get this to work is to create a report code function with hundreds of thousands of IF statements: IF ItemNo = "12345" Then ItemName = "XYZ Product"
This is slow and cumbersome to say the least. If the data sources were under my control, I could simply add a table in SQL, but I cannot in this environment. I have even tried linking to external datasource and that is not allowed by the environment. I am looking into creating some kind of XML data or trying to add data directly to the RDL, but I am running out of options.
Does anyone know of a any way to add a set of data or create an embedded dataset that contains static values. Any help would be greatly appreciated.
Thank you in advance,
Eric.
You could add a shared dataset that uses a table variable. So just create a new shared dataset and use a query like
DECLARE #t TABLE(ItemNo int, ItemName varchar(100))
INSERT INTO #t VALUES
(12345, 'XYZ Product'),
(23456, 'ABC Product')
SELECT * FROM #t
You could use this in each report and do a lookup to it to get the data you require.
Hopefully you have enough access to create a shared dataset, if not you would have to copy this to each report but it will be faster than thousands of IIFs
You could code this in VBA in the custom code section of the report. And/or make this a custom DLL which can source the data from wherever you want. The lookup code would be contained in the custom DLL in that case (pass in an input and the code returns the lookup).
Create a Data Source of Type XML
Create a Data Set and set the Data Source Created at step 1
Set Query Type to Text
Add some XML there is an example below
You should now see 3 columns in your output, I know its late but I was searching for this myself and hopefully will help someone else
<Query>
<XmlData>
<?xml version="1.0"?>
<Months>
<Month MonthValue="1">
<Name="January" />
<ShortName="Jan" />
</Month>
<Month MonthValue="2">
<Name="February" />
<ShortName="Feb" />
</Month>
<Month MonthValue="3">
<Name="March" />
<ShortName="Mar" />
</Month>
<Month MonthValue="4">
<Name="April" />
<ShortName="Apr" />
</Month>
<Month MonthValue="5">
<Name="May" />
<ShortName="May" />
</Month>
<Month MonthValue="6">
<Name="June" />
<ShortName="Jun" />
</Month>
<Month MonthValue="7">
<Name="July" />
<ShortName="Jul" />
</Month>
<Month MonthValue="8">
<Name="August" />
<ShortName="Aug" />
</Month>
<Month MonthValue="9">
<Name="September" />
<ShortName="Sep" />
</Month>
<Month MonthValue="10">
<Name="October" />
<ShortName="Oct" />
</Month>
<Month MonthValue="11">
<Name="November" />
<ShortName="Nov" />
</Month>
<Month MonthValue="12">
<Name="December" />
<ShortName="Dec" />
</Month>
</Months>
</XmlData>
</Query>
On attempting to write to a table, I need to know if the row was updated (new row created or existing row updated) or not. I would have got this value from the affected-rows value.
Previously, the solution would have been to build a class like org.mule.transport.jdbc.sqlstrategy.SimpleUpdateSqlStatementStrategy and re-implement it to return the affected-rows value instead of the row itself.
However, it seems like the JDBC transport has been deprecated in favor of the Database connector, and I am finding it hard to track down the code or how to implement the functionality.
SOLUTION :
David's reply got me down the right track! Thanks David.
However, this problem was fixed in the mysql-connector-java in versions 5.1.27 and above.
So, the POM needed to be upgraded.
mysql
mysql-connector-java
5.1.27
I was able to achieve the right results using DBCP2 as follows:
<spring:beans>
<spring:bean id= "jdbcDataSource" class ="org.apache.commons.dbcp.BasicDataSource" name= "Bean">
<spring:property name= "driverClassName" value ="com.mysql.jdbc.Driver" />
<spring:property name= "username" value = "root"/>
<spring:property name= "password" value = "root"/>
<spring:property name="url" value="jdbc:mysql://localhost:3306/local1?useAffectedRows=true"/>
<!-- Following properties added for having auto reconnect mechanism-->
<spring:property name= "testOnBorrow" value = "true"/>
<spring:property name= "validationQuery" value = "select 1"/>
</spring:bean>
</spring:beans> <db:mysql-config name="MySQL_Configuration" dataSource-ref="jdbcDataSource" doc:name="MySQL_Configuration"/>
From the documentation:
target #[payload] The enricher expression used to enrich the current message with the result of the SQL processing.
This should allow you to define an expression that would tell Mule where to store the outcome of the update, which is the number of updated rows.
From the integration test suite:
<db:update config-ref="dbConfig"
target="#[header:OUTBOUND:updateCount]">
<db:parameterized-query>update PLANET set NAME='Mercury' where POSITION=4</db:parameterized-query>
</db:update>
This sets an outbound property named updateCount with the number of updated rows. I'd personally suggest to instead set a flow variable with #[flowVars['updateCount']], but it depends on your use case.
so, i was trying to implement a stored procedure with multiple results sets in entity framework.
it all seemed to be too easy.
but, i am not getting any rows for my results sets (even though, it seems i do get the result sets themselves back).
What i have done:
created the stored procedure which returns 3 result sets
Created the complex type that represents the return values
manually edited the edmx file as per Stored Procedures with Multiple Result Sets
Failed with 3 and tried the code version from the same page, still no rows back.
Reverted the code back to 3.
my edmx file (related content only):
<FunctionImport Name="getGlobalReport2">
<ReturnType Type="Collection(MTModel.GlobalReport2)"/>
<ReturnType Type="Collection(MTModel.GlobalReport2)"/>
<ReturnType Type="Collection(MTModel.GlobalReport2)"/>
<Parameter Name="regions" Mode="In" Type="String" />
<Parameter Name="countries" Mode="In" Type="String" />
<Parameter Name="companySizes" Mode="In" Type="String" />
<Parameter Name="products" Mode="In" Type="String" />
</FunctionImport>
<FunctionImportMapping FunctionImportName="getGlobalReport2" FunctionName="MTModel.Store.getGlobalReport2" >
<ResultMapping>
<ComplexTypeMapping TypeName="MTModel.GlobalReport2" />
</ResultMapping>
<ResultMapping>
<ComplexTypeMapping TypeName="MTModel.GlobalReport2" />
</ResultMapping>
<ResultMapping>
<ComplexTypeMapping TypeName="MTModel.GlobalReport2" />
</ResultMapping>
</FunctionImportMapping>
my code:
var x = mtEntities.getGlobalReport2(regions, countries, companySizes, products);
Response.Write(x.Count());
var y = x.GetNextResult<GlobalReport2>();
Response.Write(y.Count());
var z = x.GetNextResult<GlobalReport2>();
What i have allready checked:
Checked that the server receives the request as per How can I view live MySQL queries?
Run the query i grabbed from the server and made sure it returns result sets and rows
Debug the app to see there are no Exceptions i missed on the way
There seems to be no issue with the call, or the app, except that no rows are returned.
Any suggestions?
EDIT:
as per your comments about the edmx being overwritten, that would happen only if i regenerate the model from the database, not if i update it.
i wouldn't expect anything else, since its regenerating the model.
Dont you think you should have some property defined for your complex types you have created ? For example:
<FunctionImportMapping FunctionImportName="GetGrades"
FunctionName="SchoolModel.Store.GetGrades" >
<ResultMapping>
<ComplexTypeMapping TypeName="SchoolModel.GradeInfo">
<ScalarProperty Name="EnrollmentID" ColumnName="enroll_id"/>
<ScalarProperty Name="CourseID" ColumnName="course_id"/>
<ScalarProperty Name="StudentID" ColumnName="student_id"/>
<ScalarProperty Name="Grade" ColumnName="grade"/>
</ComplexTypeMapping>
</ResultMapping>
</FunctionImportMapping>
Check this too
Also as rightly stated by Mike in the comment to your question, if you in future update your edmx file, if it's regenerated you're going to lose to customizations.
I am making a web application and have a webform connected to an access database table. For one of my queries I have a table with supplier info and I need to filter the results by name, city, and type.
I used the query builder to have the parameters input by the user through 3 textboxes (one for each parameter). When I run the query in the query builder the results come up fine, but when I run it through a browser it fails (the form shows up fine, but it's not taking the input parameters in the textbox to populate the table). I made sure I linked the parameters to the texbox control through the wizard.
I've built forms with a single input parameter controlled with a single textbox and those have worked just fine, but when I used multiple parameters and textboxes it doesn't work in the browser.
I appreciate any help! Thanks!
Make sure you bind control with parameter.
<SelectParameters>
<asp:ControlParameter Name="Comments" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="txtLastName" Name="Title" PropertyName="Text" Type="String" />
</SelectParameters>
You can pass parameters runtime as below.
<SelectParameters>
<asp:Parameter Name="Comments" Type="String" />
<asp:Parameter Name="Title" Type="String" />
</SelectParameters>
protected void AccessDataSource1_Selecting(object sender, System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs e)
{
if (txtFirstName.Text.Length > 0 && txtLastName.Text.Length > 0)
{
e.Command.Parameters["parameter1"].Value = txtFirstName.Text;
e.Command.Parameters["parameter2"].Value = txtLastName.Text;
}
}
When executing a report in MSCRM 2011, you have two options for the data sources : either SQL or Fetch.
In SSRS execution logs, the user who ran the report is always the service account.
When using fetch, in the report execution log, there is a parameter CRM_FullName containing the full name of the user who ran the report.
When using SQL source, there is no CRM_FullName parameter. How can I know who ran the report? There must be a way to know, since the Filtered views know who I am.
There is actually no way to find this information. When you create a report for MSCRM, you use a connector called "MSCRM Data Connector". This can be seen in the AdditionnalInfo column of the ExecutionLogs3 view on the SSRS instance. When using this connector and trying to show a report, you will get prompted for username and password. That's where things get interesting.
The report is not actually expecting a username/password! In fact, it expects to receive the systemuserid (guid) as username and the organizationid (guid) as password. It then search in the MSCRM_CONFIG database for the organization database settings. Then, it goes into the organization database and simply do a set context_info SYSTEMUSERID. Finally, the filteredviews are calling a function named '[dbo].[fn_FindUserGuid]' that retrieves the context_info. That is how the filtered views are properly working, while connected as the service account.
As you might have expected, we can't know the user who ran the report because the username and password prompts in SSRS are never logged anywhere (for security matters, perhaps).
The best option that I have found to log who ran a report is to actually create a stored procedure that will make a select statement on the filtered views (or any tables, as it is) and then log into a separate table the statement, the procedure parameters and the context_info(). Then, in SSRS I call that function instead of going to the filtered views directly.
Answer edited to include the getting the user fullname if sql source is used.
Register a parameter, UserID, with default value as
=User!UserID
Use the following query in your dataset
SELECT DomainName, FullName
FROM SystemUserBase
WHERE (DomainName = #UserID)
Then use
=Fields!FullName.Value
in your report.
In the CRM the user data is stored in the SystemUserBase table, and the DomainName column is the actual Domain\Username stored in User!UserID of the report.
If you prefer using views, use FilteredSystemUser view instead of SystemUserBase table.
For fetchxml try the following:
The operator operator='eq-userid' means equal to the current user.
<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>
<entity name='team'>
<attribute name='name' />
<attribute name='businessunitid' />
<attribute name='teamid' />
<order attribute='name' descending='false' />
<link-entity name='teammembership' from='teamid' to='teamid' visible='false' intersect='true'>
<link-entity name='systemuser' from='systemuserid' to='systemuserid' alias='user'>
<attribute name='fullname' />
<attribute name='systemuserid'/>
<filter type='and'>
<condition attribute='systemuserid' operator='eq-userid' />
</filter>
</link-entity>
</link-entity>
</entity>
</fetch>
Then in your report you can use the following code in an expression to get the users fullname
=First(Fields!user_fullname.Value, "GetUserData")
where the dataset is called GetUserData
Will the user login name suffice? i.e. can you just use something like
="Generated by " & User!UserID ?