Transform the contents of a column in Excel - worksheet-function

I have a .csv file which consists of 7 columns: ID, Title, Media-Type, Published, Content, Source and Label.
The .csv file/dataset is as given here:
Dataset
Now, what I want to do is transform the values given the last column of "Label". That is, I want to convert the "0"s in the dataset to read as "FALSE" and the "1"s in the dataset to read as "TRUE". Simply put, I want "TRUE" in place of 1s and FALSE in place of 0s. Is there any way this can be done? Any kind of help is appreciated. Thanks a lot in advance.

Use Get & Transform to open the CSV file, then select the column, replace 1 with TRUE and 0 with FALSE and load the result into a worksheet. That way you will have no formulas in the sheet. With Get & Transform you can also repeat the query with one click if the underlying data source changes.

You can use a formula like this.
=IF(G2=1,TRUE, FALSE)

Related

how to read 1 excel file with multiple sheet

I need to get specific value from data table 1 sheet1, sheet2, sheet3, sheet4 and write it to specific cell in my data table 2.
what approach I should do.
I want it to be dynamic.
Please do provide more specific. I am assuming you need to read all the sheets in an excel file and act to that data. For read all the sheets in an Excel file (.xlsx) I used the following:
Then I iterated through the sheet names to read each sheet
Hope this helps for the first part of your question!

Power Query - conditional replace/clear entire cell in multiple columns

I'm trying to clear the entire cell if it doesn't contain a given keyword.
I've managed to do this for one column:
Table.ReplaceValue(#"PrevStep",each [#"My Column"], each if Text.PositionOf([#"My Column"],"keyword")>-1 then [#"My Column"] else null,Replacer.ReplaceValue,{"My Column"})
The problem is I need to iterate/repeat that step for a number of columns... the number of columns may vary and column names also may be different every time. I can have all those column names put into a list but I'm not able to use it.
The solution I'm looking for may look like this
for each ColNam in MyColumnsList
Table.ReplaceValue(#"PrevStep",each [#"ColNam"], each if Text.PositionOf([#"ColNam"],"keyword")>-1 then [#"ColNam"] else null,Replacer.ReplaceValue,MyColumnsList)
next
but this is not the VBA code but Power Query M - and of course the problem is with #PrevStep as I would see it like a recursions... again... do not know how to process.
Is the path I follow correct or should it be done some other way
Thanks
Andrew
Unpivot your columns to turn all the columns into two columns. Apply your replacement to the single value column then pivot it back into the original format

How to read an excel sheet and put the cell value within different text fields through UiPath?

How to read an excel sheet and put the cell value within different text fields through UiPath?
I have a excel sheet as follows:
I have read the excel contents and to iterate over the contents later I have stored the contents in a Output Data Table as follows:
Read Range - Output:
DataTable: CVdatatable
Output Data Table
DataTable: CVdatatable
Text: opCVdatatable
Screenshot:
Finally, I want to read the text opCVdatatable in a iteration and write them into text fields. So in the desired Input fileds I mentioned opCVdatatable or opCVdatatable+ "[k(enter)]" as required.
Screenshot:
But UiPath seems to start from the begining of the Output Data Table whenever I called for opCVdatatable.
Inshort, each desired Input fileds are iteratively getting filled up by all the data with the data stored in the Output Data Table.
Can someone help me out please?
My first recommendation is to use Workbook: Read range activity to read data from Excel because it is quicker, works in the background, and does not require excel to be installed on the system.
Start your sequence like this (note the add headers property is not checked):
You do not need to use Output Data Table because this activity outputs a string containing all row items. What you want to do instead is to access the items in the data table and output each one as a string in your type into, e.g., CVDatatable.Rows(0).Item(0).ToString, like so:
You mention you want to read the text opCVdatatable in an iteration and write them into text fields. This is a little bit more complex, but i'll give you an example. You can use a For Each Row activity and loop through each row in CVDatatable, setting the index property if required. See below:
The challenge is to get the selector correct here and make it dynamic, so that it targets a different text field per iteration. The selector for the type into activity will depend on the system you are targeting, but here is an example:
And the selector for this:
Also, here is a working XAML file for you to test.
Hope this helps.
Chris
Here's a different, more general approach. Instead of including the target in the process itself, the Excel would be modified to include parts of a selector:
Note that column B now contains an identifier, and this ID depends on the application you will be working with. For example, here's my sample app looks like. As you can see, the first text box has an id of 585, the second one is 586, and so on (note that you can work with any kind of identifier including the control's name if exposed to UiPath):
Now, instead of adding multiple Type Into elements to your workflow, you would add just a single one, loop over each of the datatable's row, and then create a dynamic selector:
In my case the selector for the Type Into activity looks as follows:
"<wnd cls='#32770' title='General' /><wnd ctrlid='" + row(1).ToString() + "' />"
This will allow you to maintain the process from the Excel sheet alone - if there's a new field that needs to be mapped, just add it to your sheet. No changes to the Workflow are required.

How do I specify columns to include in a matrix

I have a matrix that has a group filtered at the matrix level. I can't filter the SQL because it is very large and is used all over my report.
I need to be able to specify the columns to display after the filter is applied.
The end filter would look something like this
if ColumnA[value] IN Test1,Test2,Test3 OR ColumnB[name]
As you can see I want a value string filter and make sure ColumnB get displayed at all times.
Or being able to specify the columns to show in the matrix would work also.
You can filter at the dataset level: see here for more detail.
To filter a tablix, go into Tablix Properties and open up the Filters tab. You can write a Boolean expression (must evaluate to TRUE for the record to come into the Tablix) to do the filtering there.
I ended up using a tablix and creating columns for each column I wanted to display and rows for each row item. I then used a Count(IIF()) statement to match the specific item I needed to calculate for that cell. I wanted to use the matrix so it would not be so long winded but in the end I got the job done. I have since used this method on many occasions.

iReport + XPath - Sum String Column

I'm building a report where I have a subreport. This subreport brings some data through XPath, this means it's everything strings from a XML. One of the columns of this subreport has some values, where I need do sum them and show in the end of the table.
I don't know how to put this to work. I've tried to create a variable with sum parameter, but it does not work.
Did anybody need this before?
Scenario:
I load a lot of values from a XPath query, e.g:
/something/something1/something2
This query returns some fields according to my needs. With them I build a table (in a subreport). The problem is: the last column (4), values are strings from XML.
iReport version: 3.0.0
Really thanks!
Solution:
What I needed? According to the original post, a column with strings read from a XML through XPath and a footer with the sum.
Result from column SUM
What to do? Create a variable where you'll keep your sum. After created, edit it. e.g:enter image description here
Fill variable expression with the format you need. Here I used
new BigDecimal($F{theFieldToSum});
Click ok. Now the variable is created, you must create a new TextField where you'll show your sum. Create it and edit it. Here I used the following format:
new java.text.DecimalFormat("#,##0.00").format($V{theVariableYouCreatedBefore})
Click "Apply" and that's all. Compile your report and now you'll have the expected result. For sure, you can do some adapt, but in general this is the process.

Resources