Is it possible to retrieve the SQL queries from a report in business objects using the SDK.
Any tutorials or code would be useful.
regards,
nithen
I'll assume you know how to get a WebI DocumentInstance object via the Java SDK.
DocumentInstance docInst; // get your DocumentInstance object via preferred route
DataProvider dp = docInst.getDataProviders().getItem(0); // retrieve the DataProvider that you would like the SQL for
String sql = dp.getQuery().getSQL(); // the SQL out of the DataProvider
getSQL() is depreciated so it may vanish in the next version
Related
I want to check given string palindrome or not and I want to write the logic in WebMethods,
Is anyone help me on this, because I am new in the WebMethods..
I would recommend you to write a Java service, with a Webmethods Flow this will be rather painful and not good for performance. In a Webmethods Java service you can use the same libraries as in a normal Java application
First Step, Create a Java service
Define in- and output
Than you get the input in java
IDataMap map = new IDataMap(pipeline);
String stringToCheck = map.getAsString("stringToCheck");
Now its your turn to implement the logic to check for palindrome, you can simply use the put Method from the IDataMap Class to define the service output
map.put("isPalindrome", palindromeCheckResult);
I want to track pipeline changes in source control, and I'm looking for a way to programmatically retrieve the json representation from the ADF.
The .Net routines return the objects, but sadly ToString() does not return json (wouldn't THAT be convenient?), so right now I'm looking at copying the json down by hand (shoot me now!), or possibly trying to recreate the json from the .Net objects (shoot me later!).
Please tell me I'm being dense and there is an obvious way to do this.
You can serialize the object using Newtonsoft Json.
See (https://azure.microsoft.com/en-us/documentation/articles/data-factory-create-data-factories-programmatically/) for how to connect via the ADF SDK
var aadTokenCredentials = new TokenCloudCredentials(ConfigurationManager.AppSettings["SubscriptionId"], GetAuthorizationHeader());
var resourceManagerUri = new Uri(ConfigurationManager.AppSettings["ResourceManagerEndpoint"]);
var manager = new DataFactoryManagementClient(aadTokenCredentials, resourceManagerUri);
var pipeline = manager.Pipelines.Get(resourceGroupName, dataFactoryName, pipelineName);
var pipelineAsJson = JsonConvert.SerializeObject(pipeline.Pipeline, Formatting.Indented);
I was expecting something more complex but looking at the sdk source GitHub it is not doing anything special.
Our team has a deployment tool that takes git changes and deploy them appropriately. Everything is done asynchronously and being controlled and versioned through git.
In a nutshell our deployment has the following flow:
Any completed git merge request triggers a VSO build. This is simply
building the whole solution via MsBuild.
Every successful build is applied a Git tag for tracking of Last Known Good.
Next (if build succeeded) our .net ADFPublisher starts by taking only the changed data factory files and asynchronously publishing them based on their
git operation (modified, add, delete, etc.).
For some failures cases our ADFPublisher will perform a retry.
This whole process (Build + publish) takes ~ 65 seconds and has
already saved us from having several bugs. It also allows us to move
definitions from one environment to another very easily.
Let me know if you think this is something that you will be interested in and I will setup a way to share it with you
I'm getting the following exception:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'answerRepository': Invocation of init method failed; nested exception is org.springframework.data.couchbase.core.UnsupportedCouchbaseFeatureException: Repository uses N1QL
I'm using Spring 4.2.0.RELEASE with spring-data-couchbase 2.0.0.M1 against Couchbase 2.5.1 enterprise edition (build-1083)
I can't see any explanation in the doc for this error.
Here is the repository:
public interface AnswerRepository extends BaseRepository<Answer, String> {
final static String DESIGN_DOCUMENT = "answers";
#View(viewName = "answers_by_quizId_startTime", designDocument = DESIGN_DOCUMENT)
public List<Answer> findByQuizIdAndStartTime(String quizId, long startTime);
Answer findByUuid(String uuid);
}
#NoRepositoryBean
public interface BaseRepository<T, ID extends Serializable> extends CrudRepository<T, ID> {
}
Maybe my Couchbase server does not support this feature, whereas my repository expects it.
I might need to code my repository differently.
It's too bad it doesn't say which method is the invalid one here.
Or it is my using of the CrudRepository in the base class ?
I wonder how to find out which views it expects to find in my Couchbase server.
Repositories in Spring Data Couchbase 2.0 rely almost exclusively on Views and N1QL. A good chunk of the new features in this version are made possible by N1QL, which is now the default mechanism Spring Data uses for things like "query derivation" (implementing a repository method by producing some sort of query that is derived from the method name).
Couchbase Server 2.5.1 doesn't have access to N1QL (which came with Couchbase Server 4.0 and of course also in the brand new 4.1 version).
If you want Spring Data to implement findByUuid for you, you'll have to annotate that method with #View and create the appropriate view that emits uuids from your Answer documents.
View query derivations are heavily restricted and give you more work since you have to write the correct map function:
a repository method based on a view can only query with one criteria.
you have to create your view correctly, emitting the correct keys corresponding to the criteria you'll query with.
you have to create one view per entity class, restricting the view to only emit if the "_class" field in the JSON matches said entity (note: this field can be renamed in the configuration so make sure to use the relevant one).
So that means that your findByQuizIdAndStartTime cannot work either. You may have to implement this (and maybe findByUuid) in the BaseRepository, relying on the CouchbaseTemplate and using its findByView method (or even queryView as a last resort).
The UnsupportedCouchbaseFeatureException is mentioned in the M1 doc chapter 7 (on N1QL based querying).
See also the section on view query derivation further down the documentation.
I'm very new to SQL Server, Flot.js, working with databases in general. I'm working on a project in ASP.NET MVC 4 (using VS 2012) which has a Microsoft SQL Server Compact 4.0 database filled with data, and I would like to visually display this data using flot.js.
I haven't been able to find any information on the general steps one would take to manipulate the data. Starting with the DB entries in the SQL CE database, and ending with a JSON file (or a CSV - anything flot.js could use as input), what would be the most common approach that a web developer could tak, using ASP.NET MVC 4?
Hi your question is quite broad so I apologise if answer is quite vague in places. As you have an existing database it would make sense to use Entity Framework Database First to map your database to a meaningful context which can then be manipulated in your code. Once you have created an edmx model you can then use it in your controllers to manipulate data:
public class YourController : Controller
{
private DatabaseEntities db = new DatabaseEntities();
//.... Your controller actions
Database First allows you to reverse engineer a model from an existing database. The model is stored in an EDMX file (.edmx extension) and can be viewed and edited in the Entity Framework Designer. The classes that you interact with in your application are automatically generated from the EDMX file.
Flot takes data in the following format:
[[1,2],[3,4],[5,5]] // x, y coordinates
[[1,"a"],[2,"b"],[3,"c"]] // Categories
See the Flot documentation for further details. So using Json will not work with flot directly. You will have to create a controller action that returns the data you require in the correct format:
public string GetData()
{
var query = db.Table.Where(... // linq query for desired data
var builder = new StringBuilder();
builder.Append("[");
foreach (var item in query)
builder.AppendFormat("[{0}, {1}], ", item.x, item.y);
var result = builder.ToString();
return result;
}
Now on the client side you can make a call from jQuery to get the data and draw the chart:
$(function () {
$.getJSON("../controller/action", function (data) {
$.plot("#placeholder", [data], {
// your chart
Just one way of doing it, but think its a good way using MVC. Hopefully this will give you a good overview and you should have enough info from this to get started at least.
I'm using LINQ to SQL to call some reporting stored procedures.
Each stored procedure returns a class which accepts some input parameters, for example:
public partial class csp_WeekCommencingListResult
{
public static IEnumerable<csp_WeekCommencingListResult> GetAll(int? masterTrackingGroupId)
{
using (var dataContext = OscaDataContext.CreateWithCustomTimeOut())
{
return dataContext
.csp_WeekCommencingList(masterTrackingGroupId)
.ToList();
}
}
}
How could I cache the result of the stored procedure for the passed parameters?
For example, when 1 is passed to this stored procedure, its result should be cached for a day.
Any thoughts? is there any framework I can use? or I have to build my own custom cache manager per stored procedure using the .NET Cache object?
Thanks,
You should probably add caching at a higher level, for example in the code that is calling this code.
Try to figure out a good caching strategy that works with your project.
And when it comes to cache managers, I usually use the ICacheManager from Microsoft EnterpriseLibrary Caching which I property inject with some dependency injection framework like Castle or StructureMap. That way I can run different configurations for different environments (dev, test, prod etc).