How to use existing namespace with variable object name in mel expression? - mel

I have an existing namespace called "Target" that I want to hardcode in my script.
What is the proper syntax to combine the "Target:" namespace with the $joints[$1] variable below? The way it is now definitely doesn't work.
connectAttr -f ("Target:" + $joints[$i] + ".worldMatrix[0]") ($nodeName + ".target[0].targetMatrix");
Thank you for any guidance!

Related

WildCards in SSIS Collection {not include} name xlsx

I have a process built in SSIS that loops through Excel files and Import data only from those that include name Report.
My UserVariable used as Expression is: *Report*.xlsx
and it works perfectly fine. Now I am trying to build similar loop but only for files that DOES NOT include Report in file name.
Something like *<>Report*.xlsx
Is it possible?
Thanks for help!
Matt
In your loop, put a Script task before your first task. Connect those two with a line. Right click that line and set Constraint Options to expression. Your expression would look like this...
FINDSTRING(#var, "Report", 1) == 0
Where #var is the loop iterable.
Only files without "Report" inside will proceed to the next step.
Referencing this exact answer. SSIS Exclude certain files in Foreach Loop Container
Unfortunately, you cannot achieve this using SSIS expression (something like *[^...]*.xlsx) you have to search for some workarounds:
Workarounds
First
Get List of - filtered - files using an Execute Script Task before entering Loop and loop over then using ForEach Loop container (Ado enumerator)
You have to a a SSIS variable (ex: User::FilesList) with type System.Object (Scope: Package)
Add an Execute Script Task befor the for each Loop container and add User::FilesList as a ReadWrite Variable
In the Script Write The following Code:
Imports System.Linq
Imports System.IO
Imports System.Collections.Generic
Public Sub Main()
Dim lstFiles As New List(Of String)
lstFiles.AddRange(Directory.GetFiles("C:\Temp", "*.xlsx", SearchOption.TopDirectoryOnly).Where(Function(x) Not x.Contains("Report")).ToList)
Dts.Variables.Item("FilesList").Value = lstFiles
Dts.TaskResult = ScriptResults.Success
End Sub
In the For each Loop Container Choose the Enumertaion Type as 'From variable Enumerator' and choose FilesList variable as a source
ScreenShots
Second
Inside the for each loop add an Expression Task to check if the file contains Report string or not
Add a variable of type System.Boolean (Name: ExcludeFile)
Inside the ForEach Loop Container add an Expression Task component before the DataFlowTask you that imports the Excel File
Inside The Expression Task write the following:
#[User::ExcludeFile] = (FINDSTRING(#[User::XlsxFile], "Report", 1 ) == 0)
Double Click on the connector between the expression task and the DataFlowTask and write the following expression
#[User::ExcludeFile] == False
Note: It is not necessary to use an Expression Task to validate this you can use a Dummy DataFlowTask or a Script Task to check if the filename contains the Keyword you want to exclude or not

Some files have 'XMLNS' listed, others just 'XSI'. How do I set an alias for the xpath query that will work with either?

Some files I need to process have this (called the "haves"):
<ApolloDataSet xmlns="http://irisoft.com/ApolloDataSet1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Other files in the same group have this (called the "have-nots"):
<ApolloDataSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
I can set the default namespace for xpath with the below:
.setProperty "SelectionNamespaces", "xmlns:a='http://irisoft.com/ApolloDataSet1.xsd'"
That works for the haves, like a:/Element, but not the have-nots, since the xpath doesn't have the a: alias.
I tried removing the xmlns attribute before processing, in the hopes that I could just use an unaliased path for both, like /Element, but that only worked for the have-nots (the haves just returned nothing).
So is there a way to process both using the same alias, or no alias? I'm trying to either use the same alias for every file, regardless of "xmlns" being listed, or use no alias for either.
Well I resigned to using the workaround I was trying to avoid. But here is an option for this situation until I find a better one. (And forgot to mention - using VBA for this.)
After the domDocument is loaded, I use the getAttribute method to check if the "xmlns" attribute value is null. If it is I form the xpath string with no alias by means of a vbnullstring, which means the xpath query works with the have-not files (i.e. those files with no "xmlns" listed). If it is not null, I use the "xmlns" value to build a string for the setProperty method setting the "SelectionNamespaces" secondary property.
If IsNull(xPOG.DocumentElement.getAttribute("xmlns")) Then
strAlias = vbNullString
Else
strAlias = "a:"
xPOG.setProperty "SelectionNamespaces", _
"xmlns:" & Mid(strAlias, 1, 1) & "='" & xPOG.DocumentElement.getAttribute("xmlns") & "'"
End If
And the resulting processing takes on a rather ugly form of string building that I hoped to avoid.
It sets an IXMLDOMNode to the nodes returned from a selectnodes method using the xPath query with the strAlias variable.
Set xProducts = xPOG.SelectNodes("/" & strAlias & "ApolloDataSet/" _
& strAlias & "Products/" _
& strAlias & "Product/" _
& strAlias & "PR_UPC")
It isn't that it is bad, it just seems to lack elegance & remind me of how little I know sometimes. Which leads me to believe I'm missing some concept that could correct this. But it works, so I'll follow up if I find a better. I did find a kb article that touched on some of the concepts if it helps anyone. I'm using 6.0 though, so good conceptual explanation, just not exactly what I needed.
PRB: MSXML 4.0 Sets the XML Namespace Attribute to an Empty Value for Child Nodes

System.Collections.Generic.List<ActualEstimatation.frmEstimate.ItemInfo>' does not contain a definition for 'Where'

I am trying to bind treeview dynamically.
I Searched in Google and found some good links.
When I try to run in my system its showing error something like this
'System.Collections.Generic.List<ActualEstimatation.frmEstimate.ItemInfo>' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'System.Collections.Generic.List<ActualEstimatation.frmEstimate.ItemInfo>' could be found (are you missing a using directive or an assembly reference?)
Those links are
How to dynamically populate treeview (C#)
and sga101's Solutions
How to insert Datas to the Winform TreeView(C#) in effitive coding?
I searched in Google to solve the above issue but not found any solution.
Please help me to solve this issue.
Thanks in advance
i need to see more of your code but i believe what you are missing is LINQ statement.
here you can read about it and start to see how to implement in your application.
for example:
using (ServiceContext svcContext = new ServiceContext(_serviceProxy))
{
var query_where1 = from a in svcContext.AccountSet
where a.Name.Contains("Contoso")
select a;
foreach (var a in query_where1)
{
System.Console.WriteLine(a.Name + " " + a.Address1_City);
}
}

Create ClearCase View using CAL

I'm trying to create a new view in CAL.
I know that I can use the IClearTool interface to set up the view via an appropriate command line, but am wondering if there is also a way to do it via the IClearCase interface. The documentation suggests that it's not possible, but I'd like to be sure. :)
No I didn't see any obvious way to create a view other than using a cleartool command.
This old example is actually using IClearCase... to get Cleartool:
ClearCase.ClearTool CT = new ClearCase.ClearTool();
string result;
result = CT.CmdExec("mkview -tag " + ViewName + " -stgloc -auto");

Beginner WPF/XML question: How to get an <element> in an <element>?

I have a rather simple question. I'm trying to get information out of an XML file, and now I need to get the that's inside another
This is my XML code:
<author>
<name>Random_name1 (Random Name)</name>
<uri>http://thisisanrandomurl.com</uri>
</author>
I can get the info with this code:
Name = item.Element(ns + "author").Value,
But this gives me:
"Random_name1 (Random Name) http://thisisanrandomurl.com"
I only want the info inside the tags. Any ideas?
Thanks a lot,
- Niels
Are you using LINQ to XML? Try:
Name = item.Element(ns + "author").Element(ns + "name").Value;
to get the data inside the 'name' element. You can use Elements if there is more than one, and then use LINQ statements to select the one you want.
using System.Xml;
After then please write this code
XmlDocument myxml = new XmlDocument();
myxml.Load("D:/sample.xml");//Load you xml file from you disk what you want to load
string element_1 = myxml.GetElementsByTagName("name")[0].InnerText;
string element_2 = myxml.GetElementsByTagName("uri")[0].InnerText;
Please try this it will be useful to you...

Resources