Is it posible to get object name from location? - object

Hello is it posible that i can get object name from location.
So when i do like:
local ObjName = GetObjNameFromLoc(10, 10, 10)
print(ObjName)
It outputs me :
Block

Related

How to write .dsv file into dynamic folders in U-SQL script

I am new to U-SQL and am trying to read multiple .dsv files from a folder and write the output as .dsv files in dynamic folder/sub folder. So far I have successfully read multiple .dsv files and am able to write the files in a single location(pre-defined location) but am not able to write the .dsv files into multiple folders/subfolders. The folders and subfolders are defined based on the file name. As an example, If the file name is ABC_20200421#015814.dsv, it should be reading data from the .dsv file and write it into folder system: test/ABC/2020/04/21/File_Data.dsv
The code I have so far is :
DECLARE #ImportFile string = "*.dsv";
-- To read all the .dsv files and move them to folder locations
DECLARE #Code String = #ImportFile.Substring(0, 3);
DECLARE #CommanName String = #ImportFile.Substring(4, 14); File_Contents
DECLARE #Year String = #ImportFile.Substring(18, 4);
DECLARE #Month String = #ImportFile.Substring(22, 2);
DECLARE #File_Date String = #ImportFile.Substring(24, 2);
#result=
SELECT col1,col2,col3
FROM Table1
//Writing to dsv file:
OUTPUT #result
TO "test/"+#Code+"/"+#Year+"/"+#Month+"/"+#File_Date+"/File_Data.dsv"
USING Outputters.Text(delimiter : '|', quoting: false);
On running the code, I get an error:
E_CSC_USER_EXPRESSIONNOTCONSTANTFOLDABLE: Expression cannot be constant folded.
Details:
at token '"/test/"', near the ###:
OUTPUT #result TO ### "/test/"+#Code+"/"+#Year+"/"+#Month+"/"+#File_Date+"/STAY_REVENUES.dsv" USING Outputters.Text(delimiter : '|', quoting : false)
Any help would be appreciated. Thanks in advance.

Two workspaces, tfe_output

I'm trying to use output values from a 2nd workspace in my current one.
For example:
data "tfe_outputs" "EKS" {
organization = "EKS_Deploy"
workspace = "EKS_Deploy"
}
Then I need EKS cluster ID in one of my modules from that 2nd workspace (I already set up outputs):
2nd workspace
output "eks_cluster_id" {
description = "EKS Cluster ID"
value = module.eks-ssp.eks_cluster_id
}
1st workspace
eks_cluster_id = data.tfe_outputs.EKS.eks_cluster_id
But, running a terraform apply in the second workspace throws this:
Error: Unsupported attribute
on main.tf line 22, in data "aws_eks_cluster" "cluster":
name = data.tfe_outputs.EKS.eks_cluster_id
This object has no argument, nested block, or exported attribute named "eks_cluster_id".
This is strange to me, since I can see the correct output value in my 2nd workspace, ie. it shows a proper output. So I'm guessing I'm calling it wrong somehow. What could it be?

How do I make the output shapefile from a query be named by its corresponding value in the loop using Python?

aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps("Map")[0]
for lyr in m.listLayers("POP_ACS17"):
if lyr.supports("DEFINITIONQUERY"):
for value in listnumbers.split(','):
lyr.definitionQuery = "COLUMN=" + num
output_path=r'C:/ArcGIS/Projects/Value_by_Value/'+ num
arcpy.FeatureClassToShapefile_conversion('POP_ACS17',output_path)
How do i create a shapefile name in the folder based on the query result, and not the same name "POP_ACS17" multiple times? Instead something like num + "_POPACS17" and so on. When i type
arcpy.FeatureClasstoShapefile_conversion('POP_ACS17', num + "_"+ outputh_path)
it does not work. i get an error message
ERROR 000732: Output Folder: Dataset C:/ArcGIS/Projects/Value_by_Value/1.0/1.0_PCT_POP_ACS17 does not exist or is not supported
All I want to do is just have my output renamed by the corresponding value in the loop underscore and the default name that it already gives which is 'POP_ACS17'
so i want
1.0_POP_ACS17.shp in folder 1.0
2.0_POP_ACS17.shp in folder 2.0
3.0_POP_ACS17.shp in folder 3.0
if not then
POP_ACS17_1.0 in folder 1.0
POP_ACS17_2.0 in folder 2.0
POP_ACS17_3.0 in folder 3.0
and so on... It does not matter which order as long as I know how this can be done.
Instead of
arcpy.FeatureClassToShapefile_conversion('PCT_POP_ACS17', output_path)
do.....
arcpy.FeatureClassToFeatureClass_conversion("_PCT_POP_ACS17", output_path, value+"_PCT_POP_ACS17.shp")
make sure you add .shp otherwise each output will appear in your project file.

Acess Attributes from WX Forms

Given the following code Gist
I'm trying to use attributes from my parent class , but i can't access then.
src = BluTools.sourceFile.GetValue()
dest = BluTools.destFile.GetValue()
codigo_empresa = BluTools.codigo_empresa.GetValue()
codigo_deposito = BluTools.codigo_deposito.GetValue()
data = BluTools.data_inicio.GetValue()
But give-me error :
AttributeError: 'BluTools' object has no attribute 'sourceFile'
You need to read up on how classes work in Python. You do not normally access attributes by calling the class directly. You need to either create an instance of the class:
blue = BluTools()
blue.some_attr()
Or in your case, use self instead of BluTools
src = self.sourceFile.GetValue()
dest = self.destFile.GetValue()
codigo_empresa = self.codigo_empresa.GetValue()
codigo_deposito = self.codigo_deposito.GetValue()
data = self.data_inicio.GetValue()

SoapUI + Groovy + Get 3 test data from 3 different environment respectively

In SoapUI, We have 3 different environment and 3 different test data property files.
So my problems are:
How to set 3 different end points in SoapUI?
How to get test data as per the environment using Groovy?
I try to answer your questions
1.- How to set 3 different end points in SoapUI.
Set your test steps URL with a property like:
http://${#Project#endpoint}
And add the endpoint property in your test data file.
2.- How to get test data as per the environment using Groovy.
If you have a typical property file with key=value you can use the code shown below:
// read property file
def properties = new java.util.Properties();
properties.load( new java.io.FileInputStream( "/tmp/sample.properties" ));
proj = testRunner.testCase.testSuite.project;
def names = [];
names = properties.propertyNames();
while( names.hasMoreElements() )
{
def name = names.nextElement();
log.info name + " " + properties.getProperty(name);
proj.setPropertyValue(name, properties.getProperty(name)) ;
}
With this you save all properties in the project level, if you prefer to save in testCase or testSuite use testRunner.testCase or testRunner.testCase.testSuite instead of testRunner.testCase.testSuite.project.
Hope this helps,

Resources