How to do conditional insert when doing data migration using Scribe? - data-migration

Here is the case:
I have an SQL Database table that I want to migrate to a Dynamic CRM 4.0 database. There is a table (let's call it Table_A ) that have a particular column (Table_A.Type). I want to migrate the table A data into either the Account entities or Contact entities in Dynamic depending on the Table_A.Type. If the Type is 0, I'll put it into Contact, else if the Type is 1, I'll put it into Account.
How can I do this using the Scribe Workbench?

The problem already solved. I use formula to put a condition in the migration flow.

Related

Kentico - Unable to find a custom user column

I just took over a project from a developer who has already left an organisation and I'm doing some maintenance work in the project. I can see the following code in a custom web part
CurrentUserInfo CurrentUser = MembershipContext.AuthenticatedUser;
DateTime ExpirationDate = CurrentUser.GetValue("aps_expirationdate", DateTime.Now);
The strange thing is, I cannot seem to find this custom field 'aps_expirationdate' anywhere in the system or in the database.
I checked the following places but couldn't find it.
Checked Membership module 'User' class and 'User - Settings' class
Checked 'User' module
Did a manual Sql Search in the database to find a table with a column name 'aps_expirationdate'
but I cannot seem to find this column anywhere and the other strange thing is, when I debug the code it does return a date value. No bugs in the code so, cannot say that this is an invalid column name. Where else should I look?
Based on what you've put in your initial question, it sounds as if the column was added manually and not through the Kentico UI. In order for the data access layer or the Kentico API to know that field exists, the definition has to be stored within the Kentico module class and not just in the database.
Here's what I'd do to correct this:
Find what table the field exists in. If you want the custom field to be part of the User or User Settings objects then they need to be added to either the CMS_User or CMS_UserSetting table.
If the field does not exist in either the CMS_User or CMS_UserSetting table, then go to the Modules app in the Kentico UI.
In the Modules App, go to Membership > Classes > Users > Fields and add the aps_expirationdate field.
If you have data in the field aps_expirationdate in the other table, write a query to copy it from the other table to the CMS_User table.
Now the API call as noted above will work.
If the field is already in the CMS_User or CMS_UserSetting table, then you will have to do the following:
In SSMS, rename that field to aps_expirationdate_old.
In the Modules App, go to Membership > Classes > Users > Fields and add the aps_expirationdate field.
Assuming you have data in the aps_expirationdate_old field in the CMS_User or CMS_UserSetting table, write a query to copy it from the other table to the CMS_User table.
Your last bullet point states you "Did a manual Sql Search in the database to find a table with a column name 'aps_expirationdate'". This contradicts what you state at the end of your question which states "I cannot seem to find this column anywhere". If you cannot find what table the aps_expirationdate exists in, then check out the following SO answer to find that column in a given database.
https://stackoverflow.com/a/4849704/698678

How to insert data in azure easy table?

I want to insert the data in a specific column of azure easy table with xamarin forms.i already insert the data in a row but some fields are empty and these can be fill later by the user when user want to update the record.
for example there is a table which name isUSER(User-id,UserName,Email,Password,Mobile-No) user enter all data except MobileNo and it may or may be entered first time but may enter later.if they enter mobile number later then how I do that ?
First of all , All CRUD are operated on the object in Azure easy table .If you create this record at the first time, You could insert this record to Azure easy table. If user want to add the mobile number in the next time, you could query this record, then delete the old data, put the new record to the table.
You could refer to following link.
https://officialdoniald.azurewebsites.net/2017/02/24/xamarin-forms-azure-easy-table-accsess/
If you want to know more basic knowledge, you can refer to the link below
https://blog.xamarin.com/getting-started-azure-mobile-apps-easy-tables/

Select clause editing in RedQueryBuilder

I'm looking into using RedQueryBuilder for a web-based query builder. I want my users to be able to specify what data they want to retrieve in the select clause, but the demo site
only shows selecting a single table, rendering all the columns of that table in the result. Does RedQueryBuilder support building out a more robust select clause, like specifying which specific columns to retrieve including those joined from other tables?
I'm afraid not. The project just concentrates on defining a query to return rows not what to show in those rows.
The onTableChange callback would feed you the list of tables in the expression so could go from that to a list of available columns...
Would you want/need to alter the SQL query generated or just the display of the results?
Personally I'd be interested in changing the demo into a more useful query too although the scope of that could be huge.

COGNOS report for a simple sub query and join Query

Here is my query. I am new to Cognos and using Cognos 10. And I am having a bit difficulty in developing a report which uses a Sub Query and an Inner Join Query.
1.
SELECT ID, BATCH_DT, LOCIT FROM AOI.TEMP_BRICK
WHERE BATCH_DT < (SELECT MAX(DATE) FROM CALENDAR)
2.
SELECT A.ID, B.SAL FROM TABLE as A LEFT OUTER JOIN TABLE as B
WHERE A.ID=B.ID
First, you must understand that Cognos generates its own SQL. In order for it to do that, you must define relationships between tables in Cognos Framework Manager. Once that is done your report has 3 major parts, The Report Page(s), the Prompt Page(s) and the Query(s).
a.) Setup the CALENDAR and AOI.TEMP_BRICK tables in Cognos. You may want to define a relationship between TEMP_BRICK.BATCH_DT and CALENDAR.DATE (assuming your calendar has date records for every date that may be present in TEMP_BRICK).
b.) Next you would create a new List Report. You would grab your ID, BATCH_DT and DATE fields into the list. (Date would come from the calendar if you decided to link the two tables in step A, otherwise you use the BATCH_DT field in TEMP_BRICK.)
c.) You would open the Query pages and see that Cognos has already created one query, called Query1. You need to create a new query (we will call it qryMaxDate). That query would have one element, 'DATE' from CALENDAR. On the properties of the 'DATE' field in Data Items, you would chagne the 'Agregate Function' from None to 'Maximum'.
d.) Now edit your Query1, add a Filter on the Date from that query. In the Expression Definition, select the Queries tab and drag the 'DATE' field from your qryMaxDate. Should look something like this [Batch Date] = [qryMaxDate].[Date]
e.) You are done! Run the report. in this case, the user running the report is giving no input, so no Prompt page is necessary.
a.) Setup Table A and B in the Framework Manager. You need to define a relationship between Table A and B in Framework Manager via a Star Schema (define A.ID = B.ID and specify 1 to n, or n to 1).
b.) Create a new report and simply drag in elements from table a and table b. Their relationship is already defined in Framework manager, so there is no need to re-define it while writing reports.
Your second example is a great demonstration of the power of BI programs like Cognos. Report Authors dont need to fully understand the ways that two tables are joined... they simply pull out elements from each table and they work, as the relationships are already defined in the Framework.

Adding Column Using Subsonic 3.0.0.5 Migration

I want to know that How to Insert New Columns to an existing database Table using Subsonic 3.0.0.5 MIGRATIONS.
Basically I want to alter an existing table in MS SqlServer database and add three more columns into it.
Please tell me How I will be able to do it
Regards,
Naveed Khan
Just change your object and the column will be added/updated whatever. So if you have an object called "Post" and add a property, it will be added as a column in the DB.
See this video...
http://subsonicproject.com/docs/Simple_Repo_5_Minute_Demo
It has to do with the conventions of SubSonic.
As the object is singular, it adds the plural to the table (or expects the table to be plural).
So it will expect an object called Order to map to a table called Orders.
There is only two solutions that I can see for you
1) Rename you table to the plural name.
2) Modify Subsonic code to remove the adding of the plural.

Resources