Quantcast
Channel: Microsoft Techies
Viewing all 430 articles
Browse latest View live

How to set state for an item using Aras Innovator batch loader

$
0
0
How to set state for an item using Aras Innovator batch loader
Ans)
First find what itemtype instance you are trying to set the state.
Ex: if you are trying to set state for part.
Go to Aras iinovator Administrator section click ob life cycle maps.
Search for *Part*
Select Part Item and View.
You will see life cycle.
Now check in the life cycle to which state you are trying to set from batch loader.
In the life cycle, check the permissions who is having the rights to change the state to which u r trying to set.
Ex: If your life cycle is
Preliminary -->review-->release
If you want to set state as: review from batch loader.
First add an item using batch loader Action="Add" in AML, add all proerties of Item in the batch loader.
Ex of properties in AML.
type
 action
 item_number
 title
name
 major_rev
description
 release_date
is_current
 is_released
owned_by_id
<Item type='Part' action='add'><item_number>P0001</item_number><title>My Part</title><name>My Part</name><major_rev>1</major_rev><description>Welcome</description><unit>EA</unit><is_current>True</is_current><is_released>False</is_released></Item>
Now you have created part.
Next step is promote the same part using action="promoteitem" in AML.
<AML>
<Item type="Part" action="promoteItem" where="[PART].item_number='P0001' and [PART].is_current='1' and [PART].state='preliminary'">
<state>review</state>
</Item>
</AML>

Aras innovator create an item ApplyAML

Aras Innovator Action Merge

$
0
0
Open Nash tool
Enter Password.
Use below AML to insert item.
Action Merge: If item exist, it will update. If item is not exist, it will create new item in Aras Innovator. type would be Part, Document ,Part BOM or Change

Creating a custom event log under Event Viewer to log server events

$
0
0
Steps:
The first step is to create the new log. You have to do this in the registry. Open up regedit and navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog
Right click on the Eventlog key and click New > Key
Ex: If i give MyProject
New folder will create under : HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog
Expand HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\MyProject
Select HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\MyProject
In the right side canvas, right click.
You will see "New" option, select it..
Expand....
Add below keys one by one...

Type:REG_SZ
Name: Sources
Value: Your project Solution Name
You can give multiple values with space.
Ex: Value: Project1 Project2 Project3
Without adding this, you will not see any logs
---------------------------------------------------
Type: REG_DWORD
Name:AutoBackupLogFiles
Value:0 Hexade
---
Type:REG_Expand_SZ
Name:DisplayNameFile
Value:%SystemRoot%\system32\wevtapi.dll
--------
Type:REG_DWORD
Name:DisplayNameID
Value:100
hex
----------
Type:REG_Expand_SZ
Name:File
Value:%SystemRoot%\system32\winevt\Logs\Application.evtx
-------
Type:REG_DWORD
Name:MaxSize
Value:ed0000
Hexa
----
Type:REG_SZ
Name:PrimaryModule
Value:Application
--
Type:REG_DWORD
Name:RestrictGuestAccess
Value:1
hexa
--------
Type:REG_DWORD
Name:Retention
Value:0
hexa
-------------------------------------------
Open Command prompt as Administrator
Go to this path: C:\WINDOWS\system32
Run this:
eventcreate /l MyProject /t Information /so Application1 /id 1 /d "Test message"
Open eventvwr (Go to run type: eventvwr)
Expand Event viewer
Right click on Custom Views
Select Create Custom View
In the new window select "By source"
Under "Event source" drop down, you will see your project name which you have created.
Select it.
Ok
You will see new window.
Give Your project name, any name.Ex: MyProject.
Now you will see all logs under your folder MyProject.

In your application you have to call like this..

 catch (Exception ex)
            {
                EventLog.WriteEntry("MyProject", "Error occurred ." + ex.Message, EventLogEntryType.Error, 0x00005082);
            }

Error: Could not find schema information for the attribute/element in C# XML

$
0
0

Right-click on the project icon and choose "Properties".
Go to the "Application" tab and choose another .NET target framework.
Save changes.
Go to the "Application" tab and choose the initial .NET target framework.
Save changes => problem solved!

XML read all elements using C#

C# Read xml Attributes

An object reference is required for the nonstatic field, method, or property


Aras Innovator Item applyAML(string AML)

C# read excel OleDbConnection connection for .xls and .xlsx

c# convert excel to xml

DataSet WriteXML generates 'NewDataSet' root element

$
0
0


Solution:

 System.Data.DataSet myDs = new System.Data.DataSet("MyRoot");

C# XML read and remove namespace

There are multiple root elements. Line 1, position 33

$
0
0
Solution:

Some where you are closing your element tag.
Ex:
Error: <Root/><Child>Hi</Child></Root>
Correct: <Root><Child>Hi</Child></Root>

Change from to

$
0
0
Change from <?xml version="1.0" standalone="yes"?> to <?xml version="1.0" encoding="utf-8" ?>

If you use Dataset.WriteXml("C:\\a.xml"); you will get  <?xml version="1.0" standalone="yes"?>

 objDataSet.WriteXml("C:\\a.xml");


If you use ..you will get <?xml version="1.0" encoding="utf-8" ?>

 XmlWriterSettings settings = new XmlWriterSettings();
                            settings.OmitXmlDeclaration = false;
                            XmlWriter objwriter = XmlWriter.Create("C:\\a.xml", settings);
                            objDataSet.WriteXml(objwriter);
                            objwriter.Close();

C# XML Deserialize in to Object - xmlns='' was not expected

$
0
0

<root element xmlns=''> was not expected.
{" was not expected.} XML Deserialize in C#

dataSet.GetXml() doesn't return xml for null or blank columns

Delete a Git branch both locally and remotely

$
0
0
To delete any branch from VSO, you have to enable Alternate Authentication Credentials
Open VSO web browser.
Click on your name in the top right
Click on My Profile
Click on Credentials
Configure Alternate Authentication Credentials
Now open Visual Studio
Connect VSO.
Click on Team Explorer
Click on Home
Click on Branches
Click on Actions
Click on Open Command prompt
Now run below command to delete branch from GIT
git push origin --delete <Branch Name>

c# xml read There is an error in XML document (2, 2).

$
0
0
This is my xml
<?xml version='1.0' encoding='utf-16'?>
<Message>
<FirstName>Hunt</FirstName>
<LastName>DAvid</LastName>
</Message>
This is my code...
string xml = File.ReadAllText("c:\\Message.xml");
var result = DeserializeFromXml<Message>(xml);
I was getting error..
Solution:
Message class is missing XmlRoot

[Serializable, XmlRoot("Message")]
public class Message
{
public string FirstName { get; set; }
public string LastName { get; set; }
}

c# dictionary add if not exist

Viewing all 430 articles
Browse latest View live