-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14332 from bernt-matthias/topic/options-var
[22.01] fix `startswith` attribute of `<options>`
- Loading branch information
Showing
5 changed files
with
80 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<tool id="select_from_csvdataset" name="select_from_csvdataset" version="0.1.0"> | ||
<description>Create dynamic options from CSV data sets</description> | ||
<command><![CDATA[ | ||
echo select_single '$select_single' > '$output' | ||
]]></command> | ||
<inputs> | ||
<param name="single" type="data" format="csv" label="single"/> | ||
<param name="select_single" type="select" label="select_single"> | ||
<options from_dataset="single" separator="," startswith="Transaction_date"> | ||
<column name="name" index="1"/> | ||
<column name="value" index="2"/> | ||
<validator type="no_options" message="No data is available in single" /> | ||
</options> | ||
</param> | ||
</inputs> | ||
|
||
<outputs> | ||
<data name="output" format="txt" /> | ||
</outputs> | ||
|
||
<tests> | ||
<!-- test that csv can be selected, i.e. if the separator attribute of <options> works--> | ||
<test> | ||
<param name="single" value="1.csv" /> | ||
<param name="select_single" value="Product1" /> | ||
<output name="output"> | ||
<assert_contents> | ||
<has_text text="select_single 1200" /> | ||
</assert_contents> | ||
</output> | ||
</test> | ||
<!-- test that data from "comment" lines can not be selected, i.e. if the startswith attribute of <options> works--> | ||
<test expect_failure="true"> | ||
<param name="single" value="1.csv" /> | ||
<param name="select_single" value="Product" /> | ||
</test> | ||
</tests> | ||
<help> | ||
</help> | ||
</tool> |