Hi I would like to know how to convert a collection into list in tcl. The output I am getting is in form of collections but I want to change it to list.
Assuming you are using some synopsys tool:
set MyList [get_object_name $MyCollection]
The above should convert your collection to a list.
Generally we use collections when dumping/querying data from certain tools which use TCL (for example Design compiler from synopsys). These collections look as list but are not accessible for normal list commands. To access them you need to use "foreach_in_collection" command and need to use get_object_name (or equivalent command) and need to build list (lappend) of the output of get_object_name. From this list you can use all TCL list operations.
foreach_in_collection and get_object_name are tool specific commands and can not be found in TCL and they work only run through tool interface.
Hope this helps.
The user is likely talking about Synopsys Tcl "collections" -- an extension provided by EDA vendors like Synopsys to support a list of objects in their Tcl API.
I'm late to the party, but this simple proc is what you'll want most of the time. Note that since you'll be mapping your collection to a list of object "names" you are losing information with this mapping:
proc col2list { col } {
set list ""
foreach_in_collection c $col { lappend list [get_object_name $c] }
return $list
}
Related
I have a list of a custom object Product like this:
Product:[type=fruit, productValue=apple], Product:[type=fruit, productValue=pinapple], Product:[type=vegetable, productValue=potato],Product:[type=vegetable, productValue=carrot]
I want to obtain two lists due to the first value (type=fruit/vegetable), in Apex WITHOUT using a for cycle.
Expected result: fruitList=['apple','pinapple'] and vegetableList = =['potato','carrot']
How can I split them?
I suggest you can create a Wrapper class for Product with two variable type and productValue with String data type, as written below -
public class Product{
String type;
String productValue;
}
Then use the Wrapper instance to get the list of type and productValue easily with the help of JSON.serilize() and JSON.deserilize()
Please, let me know if it helps you out or not.
Thanks.
There is no way to split them without a loop. Unless you do it before you obtain the list. I would suggest either 2 queries to get the list of products, or just do the loop to split them up. Depends on where you are with governor limits.
Good morning all,
I'm looking in Google Data Fusion for a way to make dynamic the name of a source file stored on GCS. The files to be processed are named according to their value date, example: 2020-12-10_data.csv
My need would be to set the filename dynamically so that the pipeline uses the correct file every day (something like this: ${ new Date(). Getfullyear()... }_data.csv
I managed to use the arguments in runtime by specifying the date as a string (2020-12-10) but not with a function.
And more generally is there any documentation on how to enter dynamic parameters with ready-made or custom "functions" (I couldn't find it)
Thanks in advance for your help.
There is a readymade workaround, you can give a try "BigQuery Execute" plugin.
Steps:
Put below query in SQL
select cast(current_date as string) ||'_data.csv' as filename
--for output '2020-12-15_data.csv'
Row As Arguments to 'true'
Now use the above arguments via ${filename} wherever you want to.
Is there a sort option in kentico where you can sort list according to alphabets ?
Like list.split(",").Sort ?
Yes, you can sort macro results. As an example, if you wanted to sort the list of users in your Kentico site by their username, you could use:
GlobalObjects.Users.OrderBy("UserName")
If you want to reverse the order, then you can use:
GlobalObjects.Users.OrderBy("UserName DESC")
If you want to be able to quickly test, you can use the macro console to test your macro output. The console can be found ins the System application under Macros > Console. The horrifyingly fast GIF below shows you where to lookL
I am testing object coverage for certain reporting solution. I have hundreds of reports and I need to see if set of objects used in those reports covers the set of all possible objects. I figured out that I could use set collection to store distinct object names and then handle it in some way. As I use free version of SOAPui for time being, structure of my test is first invoking method to get XML view of single report, then use Groovy Script to append found object names into a csv file (File append method). However I would like to append those object after I get rid of duplicates. So suitable solution would be a Set variable where I could store object names from all reports and in last step store this set in a file.
How to create such reusable collection? Is there any other way I missed?
You could just declare a set like below
def setOfNames = [] as Set
// set manipulation
setOfNames.add("a")
//
Or just declare a list first, manipulate it, then finally make a set out of it
def listOfNames = []
// list manipulation
def setOfNames = listOfNames as Set
Refer http://groovy.codehaus.org/JN1015-Collections for more details
Is it possible to extract and compare the contents of the website using imacros? I would like to extract data and compare using some pre-defined information and thus modify only some fields rather than ensuring all fields within a page are set to a default. Is it possible?
Yes it is.
You can use macro to extract information and save it in JavaScript variable. And let's say you scraped data from 2 websites and if both have keyword "foo bar" you alert "foo bar found".
var test1=website_text1.search(/foo bar/gi);
var test2=website_text2.search(/foo bar/gi);
if (( test1>=0 ) && (test2 >=0 ))
{
alert("foo bar found");
}
else
{
alert("foo bar is not on both websites");
}
For the full code of what you explained it will take more information.
why not extract it in a csv file ..then use the csv as a database to compare whatever variable you might be needing,you can go futher by creating a macro to automate the csv macro comparion.make a google search on macros for csv.
I am not sure what exactly you need.
iMacros cannot perform such tasks by itself, you need scripting - either basic javascript or whatever else you know how to use (java, php, etc)
Anyway, I believe Selenium http://docs.seleniumhq.org/ may be closer to what you need. You should give it a try.