|
Re: ECL command [message #1426808 is a reply to message #1426758] |
Fri, 19 September 2014 08:37 |
Ulyana Skorokhodova Messages: 280 Registered: July 2014 |
Senior Member |
|
|
Hi Raghav,
I can see a few reasons here.
- Syntax. It should be this way:
let[val num 0] {
if [some condition] {
show-alert [...]
}
}
- You can't increment an already declared variable (in ECL). You have different ways:
- create your custom procedure:
proc "modify-if" [val x]{
if[get-view "Test Explorer" | get-tree | get-property itemCount -raw | eq 1]{
$x | plus 1
}-else {
$x
}
}
let[val num 0]{
let [val newNum [modify-if $num]]{
show-alert [$newNum | str]
}
}
- declare another variable
let [val num2 [$num | plus1]]
- use the following construction
show-alert [$num | plus 1 | str]
Please do not forget to use -raw argument and eq if you use get-property in a condition block:
let[val num 0]{
if [get-view "Test Explorer" | get-tree | get-property itemCount -raw | eq 1]{
show-alert [$num | plus 1]
}
}
Please let me know if it helped.
Yours sincerely,
Ulyana.
[Updated on: Tue, 23 September 2014 08:57] by Moderator Report message to a moderator
|
|
|
|
|
|
Re: ECL command [message #1439405 is a reply to message #1438766] |
Tue, 07 October 2014 06:08 |
|
To resolve your problem with floating point numbers you can use concat command:
list [concat "2.10"] [concat "2.20"] [concat "2.30"] [concat "2.40"]| get 0|show-alert
It's not natural and easy solution we will try to find easier way to resolve that problem later.
Yours sincerely,
Olga.
|
|
|
Re: ECL command [message #1439406 is a reply to message #1438766] |
Tue, 07 October 2014 06:09 |
|
Hi Raghav,
There are
1. Currently it is possible to read a data from CSV file (and it is easy to save an Excel spreadsheet to a csv file) by using read-csv-file command (http://download.xored.com/q7/docs/ecl-api/latest#read-csv-file).
2. Variables are immutable and once set, their value cannot be changed, but we use a term 'variable' as it more familiar and recognizable. Their value cannot be changed, but you can declare new variables as many as you need.
Possibly loop (http://download.xored.com/q7/docs/ecl-api/latest#loop) can help you this way:
// Example 1. returns how many times a 81 is divisible by 3
loop [val count 0] [val n 81] {
if [mod $n 3 | eq 0] {
recur [$count | plus 1] [$n | div 3]
} -else {
log [format "The answer is %d" $count] //prints 'The answer is 4'
}
}
Variable count is incremented there in the body of recur.
Also you can increment your variable using command global with the key -override:
global [val j 8]
log $j
global [val j [plus 1 $j]] -override
log $j
But we don't recommend increment variables this way, because it will be difficult to support such code.
3. To create custom reports you can parse our XML report or extend org.eclipse.rcptt.reporting.reportRenderer extension point as it is done in http://git.eclipse.org/c/rcptt/org.eclipse.rcptt.git/tree/core/org.eclipse.rcptt.reporting/src/org/eclipse/rcptt/reporting/internal/FileReportGenerator.java and our other renderers. You can also add custom properties to report nodes from runtime by using org.eclipse.rcptt.reporting.core.ReportManager class.
4. You can create the list values by using command repeat (http://download.xored.com/q7/docs/ecl-api/latest#repeat):
repeat -index [val x] -times 100 -command {
emit $x
} | to-list
You can replace "emit $x" by element you need.
Please let me know if my answer helped you. If it didn't, could you please clarify what exactly problems do you have in items 1, 2, 3, 4.
Yours sincerely,
Olga.
|
|
|
|
Re: ECL command [message #1735992 is a reply to message #1735838] |
Fri, 24 June 2016 08:39 |
|
To increment I suggest to use recursion
loop [val count 1] [val n 5] {
if [$count | lt $n] {
show-alert $count
recur [$count | plus 1] [$n]
} -else {
show-alert "completed"
}
}
to handle the variable I suggest to use global variables.
In RCP TT is useful to use global variable .
1.Declare the variable
global [val perspective "Initialized"]
2.To assign a dynamic variable override the global variable
global [ val perspective [get-table | get-property[concat [concat "getItems().TableItem[" $count ] "].getText()" ] -raw] ] -override
[/code]
"Ce sont les petits désirs qui rendent un jeune homme hardi."
Giovanni Giacomo Casanova
[Updated on: Fri, 24 June 2016 08:41] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05874 seconds