BizTalk - Looping - biztalk

I'm working on a project which requires to fetch the records from the file and update the same into active directory.
I am able to update single record into Active directory but not able to update multiple records.
I know we have to apply loop concept but problem is I have no idea of how to use loop concept in Orchestration and which condition has to be used.

EDIT: I'm assuming you are not asking about how to iterate through records, there are many examples out there about how to do this. If you have to iterate through a lot of records, I'd recommend implementing it in a custom class or using the XmlReceive pipeline to do so. For someone newer to BizTalk though, it might not be immediately obvious how to combine a Decision and a Loop shape....
There are.. a lot of ways to do this. You can go with a Loop shape that has a Decision shape within it. This works just like a normal loop, but you only do any processing/sending if the desired condition is met. You could think of it like this kind of C# code:
while(condition == true)
{
if (anotherCondition == true)
{
CreateAndSendMessage();
}
UpdateCondition();
}

Related

Run a code snippet before and after tests with testthat

I have a set of R functions which get called from a Ruby application and would like to test them. The R functions access data from a Postgres database so to write tests I need to populate a test database with some sample data.
I would like to avoid cleaning up the database within every test case. It would be nice if I could start a transaction before every test and rollback the transaction after.
The last paragraph of the "Writing Tests" section of this page http://r-pkgs.had.co.nz/tests.html makes me think that it's not possible to execute a block of code before every test case.
Does anyone know of any creative work arounds? I'm considering forking the project and adding the functionality but wanted to make sure I'm not reinventing the wheel.
For anyone who stumbles upon this, I ended up creating a wrapper function for test_that() which I use when getting data from postgres. Below is my solution:
db.test_that <- function(description, test_code) {
dbGetQuery(database_connection, 'BEGIN TRANSACTION')
test_that(description, test_code)
dbRollback(database_connection)
}

Accessing CoreData tables from fmdb

I'm using CoreData in my application for DML statements and everything is fine with it.
However I don't want use NSFetchedResultsController for simple queries like getting count of rows, etc.
I've decided to use fmdb, but don't know actual table names to write sql. Entity and table names don't match.
I've even looked inside .sqllite file with TextEdit but no hope :)
FMResultSet *rs = [db getSchema] doesn't return any rows
Maybe there's a better solution to my problem?
Thanks in advance
Core Data prefixes all its SQL names with Z_. Use the SQL command line tools to check out the your persistent store file to see what names it uses.
However, this is a very complicated and fragile solution. The Core Data schema is undocumented and changes without warning because Core Data does not support direct SQL access. You are likely to make error access the store file directly and your solution may break at random when the API is next updated.
The Core Data API provides the functionality you are seeking. IJust use a fetch request that fetches on a specific value using an NSExpressionDescription to perform a function. This allows you to get information like counts, minimums, maximums etc. You can create and use such fetches independent of a NSFetchedResultsController.
The Core Data API is very feature rich. If you find yourself looking outside the API for a data solution, chances are you've missed something in the API.

Is there a list of "breaking changes" (i.e. what type of changes to a workflow with break existing instances)

Is there a list somewhere that lays out all of the types of changes that can be made to an existing workflow service that would prevent existing instances of the original workflow from being re-loaded? For example, I recently made a small change to a custom activity (changed a condition in an "if" statement) and all existing workflow instances still load as normal. Now, in the past, I had removed a property on an object that the workflow uses, and when I tried to re-load a persisted workflow instance, it blew up on me.
Does such a list exist? Thanks!
As far as I am aware there isn't a list like that. You really should consider all changes as breaking. If you test thoroughly you will find a few exceptions but these will be mostly changing a single VB expression.
There is no such a list.
As far as I am concerned, you can change VB expressions always editing the .xamlx in a text editor. I say that, because in my case, sometimes the graphical editor (VS2010) changed the ids of the activities without introducing new activities (be carefull with this).
You can also change the whole internal code (not the inputs/outputs parameters) in code activities (.xaml). Because of that, it would be a good idea to put all the "high changeable" logic into code activities in order to be able to modify this logic avoiding problems with existing WF instances.

Entity Framework: Getting objects not immediately related

I am using Entity Framework for my .NET application. I have been able to return objects and their directly-related objects as well (very convenient), but I am having trouble getting the objects of those objects.
IEnumerable<Lot> i = (((ObjectSet<Car>)_carRepository.GetQuery())
.Include(a => a.CarTypes).Take(10).ToList()
This works and I can access carTypes, however I cannot figure out how to access tables associated with CarTypes (e.g. tables which have fields associated with the car types).
I tried to use a Join however I was unable to figure out how to get it to work right.
All help appreciated.
Include can be chained, but you have to keep in mind that it uses strings rather than lambdas. So you do .Include("CarTypes.Company") if you want a two level include. You can also chain Include statements which means including more than one branch from the same top level--eg. .Include("CarTypes").Include("SomeOtherTypeFromTheSameParentAsCar").
You should keep in mind, though, that deep Include statements may not produce the best possible performance because every part of an Include just adds on to the one query that you are building so you will get a larger and more complex query which does a whole bunch of joins under the covers. Sometimes it's more effective to do a few Includes in one query and then issue a second query to get the rest of your data or something like that.
With EF4 you can also setup lazy loading which can sometimes make this kind of thing even easier (but of course it produces multiple roundtrips rather than one or two very large roundtrips).
I believe you can chain Includes... So you could have something like
.Include(a => a.CarTypes.Company)
If you're just using one or two fields from each type, one possibility might be to create a view in the DB. Then you could add this view to your EF model and access those properties directly.

Drupal Views api, add simple argument handler

Background: I have a complex search form that stores the query and it's hash in a cache. Once the cache is set, I redirect to something like /searchresults/e6c86fadc7e4b7a2d068932efc9cc358 where that big long string on the end is the md5 hash of my query. I need to make a new argument for views to know what the hash is good for.
The reason for all this hastle is because my original search form is way to complex and has way to many arguments to consider putting them all into the path and expecting to do the filtering with the normal views arguments.
Now for my question. I have been reading views 2 documentation but not figuring out how to accomplish this custom argument. It doesn't seem to me like this should be as hard as it seems to me like it must be. Leaving aside any knowledge of the veiws api, it would seem that all I need is a callback function that will take the argument from the path as it's only argument and return a list of node id's to filter to.
Can anyone point me to a solution or give me some example code?
Thanks for your help! You guys are great.
PS. I am pretty sure that my design is the best I can come up with, lets don't get off my question and into cross checking my design logic if we can help it.
It's not as easy as you would like to make it.
In views, arguments are used to return objects, fx user, node, term, custom object. So you could make some custom code, to get the "query object". That would only be first step. You then need to get the info from the query object. You could either try making a custom relationship bond with the nodes or build your own filter to make the SQL needed. This can quickly become a confusing time sink.
Instead, I would suggest that you use hook_views_query_alter, which will allow you to alter the query. Since you already have the SQL, it's just a matter of checking for the hash, and if it's there, alter the query. Should be a pretty simple thing to do. Only thing that is a bit tricky, is that you have to make the query with the query object that views uses, but it's not that hard to figure out.

Resources