Following code in PBO doesn't work to hide the column completely.
LOOP AT SCREEN.
IF SCREEN-NAME EQ 'GT_SO-POSNR'
SCREEN-INPUT = 0.
SCREEN-ACTIVE = 0.
SCREEN-INVISIBLE = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
But above is disabling the column, not hiding it. Any help how to hide the Column?
Use the field INVISIBLE of the COLS table in the structure defined by the CONTROLS statement. The whole structure is documented here. There should be a sample program named RSDEMO02 in your system that lets you modify the properties of the table control and examine the results as you do so.
We had the same problem in our project and we figure out how to do it.
See below sample:
PROCESS BEFORE OUTPUT.
MODULE STATUS.
LOOP WITH CONTROL TABCTRL.
MODULE MODIFY_100.
ENDLOOP.
MODULE MODIFY_100 OUTPUT.
DATA wa_tabctrl TYPE cxtab_column .
* loop at the table control
LOOP AT TABCTRL-COLS INTO WA_TABCTRL.
IF WA_TABCTRL-NAME = 'POSNR'.
* once you get to the desired screen, flag the INVISIBLE field for the table control, not the SCREEN table.
WA_TABCTRL-INVISIBLE = 'X'.
* Modify the table for table control
MODIFY TABCTRL-COLS FROM WA_TABCTRL.
ENDIF.
ENDLOOP.
ENDMODULE.
Check the way you are trying to hide the particular column. Whenever you have a Table control on the screen there is CXTAB structure that is created against it. So disabling a field is not as simple as writing the name of the Internal table followed by the name of the column.
Your code should be something like this
PROCESS BEFORE OUTPUT.
MODULE STATUS.
LOOP WITH CONTROL TABCTRL.
MODULE MODIFY_100.
ENDLOOP.
MODULE MODIFY_100 OUTPUT.
DATA wa_tabctrl TYPE cxtab_column .
LOOP AT TABCTRL-COLS INTO WA_TABCTRL.
IF WA_TABCTRL-NAME = 'POSNR'.
WA_TABCTRL-SCREEN-INVISIBLE = '1'.
MODIFY TABCTRL-COLS FROM WA_TABCTRL.
ENDIF.
ENDLOOP.
ENDMODULE.
It shouldn't be necessary to loop through the table control content to hide the column for each line separately, as the columns definition is central for the table view.
A cleaner and much more efficient solution could look like this:
*********************************
* PBO include
*********************************
PROCESS BEFORE OUTPUT.
MODULE hide_column_0100.
*********************************
MODULE hide_column_0100 OUTPUT.
PERFORM hide_column.
ENDMODULE.
*********************************
* form include
*********************************
FORM hide_column.
FIELD-SYMBOL <col> TYPE cxtab_column.
LOOP AT table_control_0100-cols ASSIGNING <col>.
IF <col>-screen-name = 'HIDE'.
<col>-invisible = 1.
ENDIF.
ENDLOOP.
ENDFORM.
It's better to put the code into an own subroutine (FORM) to avoid unnecessary global variables (like for the work area of the LOOP). It often gets forgotten that MODULE code belongs to the global scope.
Related
Really struggling and could do with some advice please.
I have an input table in my Excel (2016) worksheet as follows;
I also have a user-defined value in the spreadsheet as follows;
The user updates the highlighted value based on the needs of the analysis. The highlighted cell has been named 'NTValue' in the worksheet.
In my query, I have already introduced a function named "GetValue" to get the value in the cell named "NTValue". This function is;
(rangeName) =>
Excel.CurrentWorkbook(){[Name=rangeName]}[Content]{0}[Column1]
This function runs successfully on its own. If I use GetValue("NTValue"), I am returned with "0.001".
I now want to introduce the GetValue function within a ReplaceValue step in my query i.e. look for all rows where Value1 = "NT" and replace the contents of Value2 with the user-defined NT Value (highlighted in yellow). The target result is as follows;
However, when I use this query, I am returned with an error..
Replace Value Query
= Table.ReplaceValue(#"Table5", each [Value2], each if [Value1] = "NT" then GetValue("NTValue") else [Value2],Replacer.ReplaceValue,{"Value2"})
Error
Formula.Firewall: Query 'New Table' (step 'Replaced Value') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.
Any ideas?
This Formula Firewall error is related to Power Query settings.
You should adjust your privacy levels.
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.
Is there any way to use a variable in the from part (for example SELECT myColumn1 FROM ?) in a task flow - source without having to give the variable a valid default value first?
To be more exact in my situation it is so that I'm getting the tablenames out of a table and then use a control workflow to foreach over the list of tablenames and then call a workflow from within that then gets data from these tables each. In this workflow I have the before mentioned SELECT statement.
To get it to work properly I had to set the variable to a valid default value (on package level) as else I could not create the workflow itself (as the datasource couldn't be created as the select was invalid without the default value).
So my question here is: Is there any workaround possible in this case where I don't need a valid default value for the variable?
The datatables:
The different tables which are selected in the dataflow have the exact same tables in terms of columns (thus which columns, naming of columns and datatypes of columns). Only the data inside of them is different (thus its data for customer A, customer B,....).
You're in luck as this is a trivial thing to implement with SSIS.
The base problem for most people is that they come at SSIS like it's still DTS where you could do whatever you want inside a data flow. They threw out the extreme flexibility with DTS in favor of raw processing performance.
You cannot parameterize the table in a SQL statement. It's simply not allowed.
Instead, the approach that people take is to use Expressions. In your case, assuming you had two Variables of type String created, #[User::QualifiedTableName] and #[User::QuerySource]
Assume that [dbo].[spt_values] is assigned to QualifiedTableName. As you loop through the table names, you will assign the value into this variable.
The "trick" is to apply an expression to the #[User::QuerySource]. Make the expression
"SELECT T.* FROM " + #[User::QualifiedTableName] + " AS T;"
This allows you to change out your table name whenever the value of the other variable changes.
In your data flow, you will change your OLE DB Source to be driven by a query contained in a variable instead of the traditional table selection.
If you want an example of where I use QuerySource to drive a data flow, there's an example on mixing an integer and string in an ssis derived column
Create a second variable. Set its Expression to create the full
Select statement, using the value of the first variable.
In the Data Source, use "SQL command from variable" option for the
Data Access Mode property.
If you can, set a default value for the variable you created in step
That will make filling out the columns from your data source much easier.
If you can't use a default value for the variable, set the Data
Source's ValidateExternalMetadata property to False.
You may have to open the data source with the Advanced Editor and
create Output columns manually.
Try as I might, I cannot figure out how to change the default table format in the pdf output from sphinx.
I could edit the .tex file, or the writer.py source code... but both of those seem like bad options.
Is there any thing that can be passed to the preamble to accomplish that?
Depending on what you are trying to accomplish by changing the table format. For instance if you want to define row colors and change the tables accordingly across the document you can use both the xcolor package and redefine how tabular handles that at the point of definition by changing the tabular environment.
So in the preamble you would do
\usepackage[table]{xcolor}
\definecolor{foo}{RGB}{236,137,29}
\definecolor{bar}{RGB}{232,108,31}
\let\newtabular\tabular
\let\newendtabular\endtabular
\renewenvironment{tabular}{\rowcolors{2}{foo}{bar}\newtabular}{\newendtabular}
This will overwrite the default tabular environment and apply the foo and bar row colors throughout the document, starting at the second row.
For having more directives related to tables. You should take a look at sphinxtr
Jeff Terrace has some great extensions included, but the two main ones to use are numfig and figtable. You can wrap a csv table into figtable.
.. figtable::
:label: my-csv-label
:caption: My CSV Table
:nofig:
.. csv-table::
:file: data/foo.csv
:header-rows: 1
Changing the standard table format with the caption below instead of above. Then you also have the added benefit of being able to directly link to that table by using :num:.
:num:`Table #my-csv-label`
It will automatically number accordingly, without referencing the label name. You can also use
.. figtable::
:spec: {r l r l}
To better define how you want your table to appear.
I have to create a birt report with user input parameters. It is something like when the para
meter is left blank it should fetch all values from a table otherwise when the user inputs the students roll no.,the corresponding data should be fetched. Can this be done through Birt report? If yes, then please suggest a way.
Thanks!
Yes, you can do that. If the parameter is optional you can't use the Dataset Parameter (with a ? in your query), because it will be null. Instead you have to modify your query using JavaScript.
Create a Report Parameter like usual, in this case 'stud_no'. Then add a comment in your SQL that you are reasonably sure is unique, I use something like --$stud_no$, wherever you want your clause inserted.
Then add a script like this to your Data Set, in beforeOpen:
if (params["stud_no"].value){
this.queryText = this.queryText.replace("--$stud_no$", "and stud_no = " + params["stud_no"]);
}
This replaces the comment with the clause when the parameter has a value. You can use regex in the search string, and then you can also insert it multiple places if you want.
Create your paremater using a like statement
where students_roll_no like ?
Create your report paramater using as a text box, with a defualt value of %
Because the percent '%' is the SQL wildcard, it returns all values. If the user enters a Student Roll number, it returns only that record. Additionally the user can enter 0500% and get all the records that begin 0500.