How to map an element from the list to a single element in Tibco? - tibco

I obtain a list of elements from the JDBC. And then I have to map an element from the returned list to another single element of a different system. Could someone help, please ? I tried for-each, but couldn't handle it. Any hints would be helpful. Thanks.

Assuming the output of your JDBC query is something like this records.A and records is repeating.
You can use the following syntax records[1].A to map the first value of the list to a non repeating elements, or if you have another fields B returned by your query and want to select the data depending on B value you can do something like this : records[B=123].A, in that second example the first record found with B=123 will be mapped to your target element.

Related

Table Extraction in UIPath if table has images

I am trying to extract the Table which has the following format
When I want to extract i should have either put some character on place up icon or i dont want that either the case is fine..
But UIPath brings this way.. 78,59,237806 all as one text which is misleading.. How to resolve this issue..
Thanks
Take a look at the Find Children activity. You can specify an item via selector (the table) and use Find Children to return a collection of type UiElement.
So set the filter to extract the "<webctrl tag='tr' />" which will effectively give you a collection of the rows.
Use a For Each to iterate through each UiElement you got from the first Find Children activity, and use that element to run another Find Children. In this case, set the filter to extract the elements with a class of "mid-wrap". This gives you a collection of the elements in the row which match that requirement, and this will exclude the data-up value, since that's a different class.
You can then loop over this collection to get the innertext attribute, which will give you the actual values you're looking for each cell in the row. Use something like Add Data Row to add the values to a datatable, and let the For Each run over the next row in the collection.

Sum value flow power automate

I have a table on azure following :
enter image description here
Can anyone help me to make a sum perday of number of users with flow power automate :
enter image description here
Thanks in advance
Ok, this is a monster of an answer but it works so follow closely.
Refer to the images for what to do.
The basic concept is, loop through all entities and fill an array with the distinct row keys. The way we determine if it's distinct or not is by adding the row key to an array IF it hasn't been added previously.
From there, we will loop through that distinct list and using an inner loop, we will sum each NumberOfUsers column IF the Inner Row Key matches the Outer Row Key that is being processed.
At the end of the outer loop, add an object to an array. That object has two fields, "RowKey" and "NumberOfUsers". The "NumberOfUsers" field contains the summation for that given RowKey.
From here, you have the distinct count.
If I've mis-used any fields (i.e. the use of RowKey) then change it up as need be.
This is just logic, you just need to apply it to the scenario. I think this is best done in an Azure Function because it'll run faster and be a lot less to maintain but if you want to avoid that and use PowerAutomate, this works.
Flow
Data / Table
Result

Distinct count a field that has been sorted by territory from another source

I am trying to find a way to get a distinct count on a field that is being filtered by a territory without using grouping because of the fact that I need to then pass this value over to another report. The easiest way would be something like this:
distinctcount({Comm_Link.CmLi_Comm_CompanyId}) if {Company.Comp_Territory}='Atlanta'
But for obvious reasons that won't work. Any thoughts?
what you have to do is a running total. Right click on {Comm_Link.CmLi_Comm_CompanyId} insert running total, type of summary will be distinct count and on evaluate where says Use a formula type your condition {Company.Comp_Territory}="Atlanta"
your formula and approach is wrong.. I doubt whether your formula compiled with out any errors...
first create the value and then find the distinct count
if {Company.Comp_Territory}='Atlanta'
Then {Comm_Link.CmLi_Comm_CompanyId}
Now in footer write or you can get it by right click on the filed.
distinctcount({Comm_Link.CmLi_Comm_CompanyId})

Use ParseQuery to get the first item found from list

I want to query Parse in order to retrieve the first object found in a given list, in the given list's order.
My code looks pretty much like this:
query = getQuery(MyClass.class).whereContainedIn("FieldName", itemList);
networkQuery.getFirstInBackground(...);
What I need, specifically, is to retrieve the first item found in the list, meaning that if I provide it a list of numbers in ascending order, I wish to retrieve the object corresponding with the smallest number possible.
I'm not sure this is how getFirstInBackground() works, I know it fetches a single result, but how can I assure the search is made according to the order of the list I provided as argument?
You have to order your query using the -orderByAscending (or Descending, i can't remember) method. It takes the column name parameter.
So something simple and easy to understand (but I'm sure you've understood already) is to order by ascending "Age" (example), and your first result in the array will be the smallest Age.
Once your query is ordered, just set a -limit to it. It's the number of results the query will return, if you only want the five firsts, set a limit of 5. or 20. The maximum is 1000.
If you also would like to skip the 3 first results because you know they're not interesting (and I'm just elaborating out of your question's scope here), you can use the -skip method, to skip the first X results.
This should do the trick to build your query. Set all those parameters and then execute your query and you'll have correct results.
EDIT : After re-reading your question I'm not sure I'm answering what you're asking. Please elaborate if I'm not.
Find the minimum value in itemList yourself, and qualify the query with that using equalTo.
// is this javascript? if so, underscorejs is very useful
var _ = require('underscore');
var minItem = _.min(itemList); // you can add an optional iteratee function that can minimize any computation over the list
query.equalTo("FieldName", minItem);
query.getFirstInBackground(...);
Edit
Parse.Query ordering applies only to sortable types, like strings and numbers. The ordering hoped for in the question is on the min() value of an array attribute. If such a thing were available, then a getFirst query would work.
What you need can still be done with find(). Since a small number of rows will have FieldName values contained in itemList, you can just do a find() and pick out the minimum from those few results...
query.find().then(function(results) {
return _.min(results, function(result) {
return result.get("FieldName");
});
});

couchdb - retrieve unique documents for a view that emits non-unique two array keys

I have an map function in a view in CouchDB that emits non-unique two array keys, for documents of type message, e.g.
The first position in the array key is a user_id, the second position represents whether or not the user has read the message.
This works nicely in that I can set include_docs=true and retrieve the actual documents. However, I'm retrieving duplicate documents in that case, as you can see above in the view results. I need to be able to write a view that can be queried to return unique messages that have been read by a given user. Additionally, I need to be able to efficiently paginate the resultset.
notice in the image above that [66, true] is emitted twice for doc id 26a9a271de3aac494d37b17334aaf7f3. As far as I can tell, with the keys in my map function, I cannot reduce in such a way that unique documents will be returned.
the next idea I had was to emit doc._id also in the map function and reduce with group_level=exact the result being:
now I am able to get unique document ids, but I cannot get the documents without doing a second query. And even in the case of a second query, it will require a lot of complexity to do pagination like this (at least I think so).
the last idea I came up with is to emit the entire document rather than the doc._id in the third position in the array key, then I can access the entire document and likely paginate. This seems really brutish.
So my question is:
Is #3 above a terrible idea? Is there something I'm missing? Is there a better approach?
Thanks in advance.
See #WickedGrey's comment to the question. The solution is to ensure that I never emit the same key twice for one document. I do this in the map function by keeping track of the keys as I emit them in an array, then skipping the emit if the key exists in the array.

Resources