I am trying to define a reference variable name inside yaml list, and when i call the list item in the robotframework, the defined reference variable name should be replaced with the value in robot script.
${var}= "Robot"
FOR ${items} IN #{yaml_list}
Log ${items}
END
Variables.yaml
yaml_list:
- "My name is ${var}"
Expecting Logged Result - My name is Robot
Related
In a class ABCD inside the init method I have variable state consisting of OrderedDict containing list of dictionaries. Basically the state is of module 'transitions' which are imported from class 'machine' and inside state I have orderedDict consisting of list of dictionaries.
class ABCD(Machine)
def __init__(self,args):
self.a=opts['a']
self.a=opts['b']
self.states=orderedDict([{'name':'start'},{'name':'connection','on_enter':'go'}])
Error is:
Argument of type "list[dict[str, str]]" cannot be assigned to parameter "__iterable" of type "Iterable[list[str]]" in function "init"
If I donot use the OrderedDict and use the dictionary instead of it, then I face the below error:
Cannot assign member "states" for type "ABCD"
"list[dict[str, str]]" is incompatible with "OrderedDict[str, State]"
I have the below variables
when i count the number of variable instances with the variable conventionCode, the api returns count = 1
http://localhost:8282/engine-rest/variable-instance/count?processInstanceIdIn=b622ad4d-9a11-11ec-937b-0242ac11000a&variableValues=conventionCode_eq_01018
when i count the number of variable instances with the variable exerciceFrameworkId, the api returns count = 1
http://localhost:8282/engine-rest/variable-instance/count?processInstanceIdIn=b622ad4d-9a11-11ec-937b-0242ac11000a&variableValues=exerciceFrameworkId_eq_SA-FR-LAB-6969284
The problem is when i use the two variables conventionCode and exerciceFrameworkId, the api returns count = 0
http://localhost:8282/engine-rest/variable-instance/count?processInstanceIdIn=b622ad4d-9a11-11ec-937b-0242ac11000a&variableValues=conventionCode_eq_01018,exerciceFrameworkId_eq_SA-FR-LAB-6969284
The API is focused on variables. So it will check each variable if your filters match.
In your example you defined 2 filters:
conventionCode_eq_01018
exerciceFrameworkId_eq_SA-FR-LAB-6969284
So for each variable with the name conventionCode and the value 01018 the first filter matches.
However, it is impossible that this matches to the 2. filter as its name is conventionCode and not exerciceFrameworkId.
So in the end you have no variables in your result.
That means it is a logical AND and not as you expected a logical OR.
See also the REST-API Reference
I'm trying to connect two parameters. In the first, the user inputs a file which contains a list (each line is one item). In the second, I'm hoping to set a parameter of type Field or GPValueTable. Here's a look at how this part of the code currently looks like:
def getParameterInfo(self):
#Define parameter definitions
# Input Features parameter
in_features = arcpy.Parameter(
displayName="Input Features",
name="in_features",
datatype="DETextFile",
parameterType="Required",
direction="Input")
# User selection
selection_field = arcpy.Parameter(
displayName="Selection list",
name="selection_field",
datatype="Field",
parameterType="Required",
direction="Input")
selection_field.parameterDependencies = [in_features]
# Derived Output Features parameter
out_features = arcpy.Parameter(
displayName="Output Features",
name="out_features",
datatype="GPFeatureLayer",
parameterType="Derived",
direction="Output")
out_features.parameterDependencies = [in_features.name]
parameters = [in_features, selection_field]
return parameters
The text file looks like this:
A
B
C
The toolbox dialog output is just A. I'm having a hard time understanding what ArcGIS intended to create here. Perhaps I'm using the wrong data types, but their parameter explanation doesn't make it very clear.
Any ideas?
You are confused with the arcpy terminology, I think. The second parameter's datatype="Field" does not imply data can be read/parsed from a text file where the data columns are written, in fact it is the schema/fields of a proper table and expectation is not a simple text but the field objects of a table/feature class (in the toolbox's run-time, assignment to arcpy.Parameter yields a geoprocessing value object but it is a different discussion). If you look at the "Creating value table parameters" section here, GPFeatureLayer's (param0) fields are populated in param1 automatically when the dependency is set.
The solution is setting your selection_field to GPValueTable and populating the selection_field.filters[0].list by reading the in_features's content after the parameter is altered but has not validated in def updateParameters(...). Have a look at https://gis.stackexchange.com/questions/370250/updating-valuetable-parameter-of-arcpy-python-toolbox-tool.
I am using XLS through C# and I need to be able to access the attributes of a specific node, but whatever I do I get the same "eof with #" error. Am I doing something wrong? Is there something I am missing? This is a code sample:
<xsl:value-of select="$main[1]#index"/>
Error message:
System.Xml.Xsl.XslLoadException: 'Expected end of the expression, found '#'.
$main[1] -->#<-- index'
To select an attribute named index of the context element use #index. Use that in a separate step if you first select elements e.g. foo/#index selects the index attributes of all foo children of the context node.
$main[0] doesn't make much sense as in XPath the first item has the index 1 so perhaps $main[1]/#index is what you want, it depends on how the variable or parameter main has been bound to a value.
I need a SharePoint workflow that will update a list (Accounts Tracker) item when a file is uploaded to a specific folder in a separate document library (Accounts Documents). The name of the folder will correspond to the line to be updated in the list.
So, as an example:
User uploads document to 'Entity 1' folder within 'Accounts Documents' library.
Workflow updates a line in 'Accounts Tracker' with the title 'Entity 1' is automatically based on the folder name in the 'Accounts Documents' library.
The question is how does the workflow reference the folder name in the library to update the correct line in the list?
so, if I understand correctly, the goal is to get the parent folder name in which the document as been added then use that name to update a list item with that name as title.
The most complex part of your workflow will be to get the parent folder name.
The name of the folder containing the document is part of the variable Current Item:Server Relative URL.
You can use a series of activities in your worklow to extract the folder name from the Server Relative URL.
Stage: Find Folder Name
Step: Set variables
Set Variable: FilePAth to Current Item:Server Relative URL
then Set Variable: TrimmedFilePath to Variable: FilePath
then Set Variable: index to 0
then Set Variable: LastIndexOf to -1
then Set Variable: PreviousLastIndexOf to -1
Loop: until last slash is found
The content of this loop will run repeatedly while Variable: index is greater than or equal to 0
Find / in Variable: TrimmedFilePath (Output to Variable: index)
If Variable: index is greater than or equal to 0
If Variable: LastIndexOf not Equals -1
Set Variable: PreviousLastIndexOf to Variable: LastIndexOf
then Calculate Variable: LastIndexOf plus 1 (Output to Variable: LastIndexOf)
then Calculate Variable: LastIndexOf plus Variable: index (Output to Variable: LastIndexOf)
then Calculate Variable: LastIndexOf plus 1 (Output to Variable: IndexPlus1)
then Copy from Variable: FilePath, starting at Variable: IndexPlus1 (Output to Variable: TrimmedFilePath)
Step: Check foldername
Calculate Variable: PreviousLastIndexOf plus 1 (Output to Variable:PreviousLastIndexOfPlus1)
then Calculate Variable: LastIndexOf minus PreviousLastIndexOfPlus1 (Output to Variable:FolderNameLength)
then Copy from Variable: FilePath, starting at Variable: PreviousLastIndexOfPlus1 for Variable: FolderNameLength characters (Output to Variable: ParentFolderName)
If (Variable: ParentFolderName equals Workflow Context:List Name)
Set Variable: ParentFolderName to Root Folder
After you need to add a Update List Item activity to your workflow.
In the Find the List Item section, use the ParentFolderName variable to retrieve the target list element.
Hope this help!
--- Answers to some questions
1st line of Loop is for explanation only?
Yes. When you add a loop in a workflow, you can also add a comment. So « until last slash is found » is just a comment
2nd line of Loop - how do I "find / in variable"?
In a workflow, you have an activity to find characters in a string variable. It's something similar to indexOf in JavaScript. In this workflow, we need to find a slash « / » character. Remember that the goal is to get the parent folder inside a URL. We can find it by seaching for the last slash inside the URL.
9th line of Loop - how many characters? 0 is default on my workflow.
The number of charaters will be calculated automaticly. Look for the variable named IndexPlus1
4th line of Check - I don't have "List Name" available in Workflow Context - can I use "Association Name"?
I dont' know the reason why you can't get the list name. Maybe you can try to create another SP 2013 workflow and see if you get the same problem?
5th line of Check - is "Root Folder" hard formatted i.e. not a lookup?
Yes. Root Folder is hard coded.