I am using a xforms:bind to do field validation for a year field. the code is at below:
<xforms:bind nodeset="instance('application-instance')/academic/cert_ordinary/year" level="year-1" constraint="if (string-length(.) < 1 ) then . = . else . castable as xs:integer and string-length(.) = 4 "/>
while the UI code is below:
<xforms:repeat ref="instance('application-instance')/academic/cert_as" id="cert-as-repeat">
<xforms:input ref="year" incremental="true" class="input_smaller">
<xforms:alert level="year-1">Must be 4 digit year!</xforms:alert>
</xforms:input>
</xforms:repeat>
the validation is working fine, but the problem is, when i add multiple row of data, the validation is not working if i insert some string into the year and then change it to number.
for example, after i put "test" for 3 rows of year, the alert will shown there but then i change it to "2014", the alert for 1 row will still remains there and wont go away.
is this a bug from orbeon? FYI i using the orbeon 4.2.
Thanks
seem like i made a mistake in the if statement
constraint="if (string-length(.) < 1 ) then true() else . castable as xs:integer and string-length(.) = 4"
this shd be the correct if statement.
thanks
Related
I am trying to find out the loss of portfolios from the current month to the prior month.
What I want to see is what missing, basically when we compare the two months together I want to display what is not matching between the two
I have put this expression.
If([portfolio_code Current ]=[portfolio_code_Prior])
Then(Count([portfolio_code Current ])
Else(0)
I am not sure my if syntax is incorrect I just wanted to give an example
any insights?
[enter image description here]
Assuming there is one portfolio per row the count of portfolios that were in last month and not this month is...
total(
If ( [portfolio_code Current ] <> [portfolio_code_Prior] && [portfolio_code_Prior] is not null)
Then ( 1 )
Else ( 0 )
)
or
total(
case
when [portfolio_code Current ] <> [portfolio_code_Prior] and
[portfolio_code_Prior] is not null
then 1
else 0
end
)
If you want to see how many were "lost" from this month to last month (how many were added form last month to this month) you would need to reverse the logic.
If you want to see how many more or less, that is much simpler:
count(distinct [portfolio_code_Prior]) -
count(distinct [portfolio_code Current ])
If you want 0 when they don't match otherwise the portfolio code, then your logic looks okay.
If you want to ONLY see the rows that do not match then add a detail filter for the custom data item, let's call it compare, like this:
[Compare] <> 0
as far as counting, you can just select the column and use count (or count distinct) depending on what you want.
I write this query I dont know why its not working for me can anyone suggest for me which is right
SELECT MAX(NVL(CPV.SR_NO,0)+1) INTO :CPV.SR_NO FROM CPV
WHERE VOUCHER_ID=4;
I have to bring MAX value I put 0 but it never bring 1 for first record after one record it worked properly mean if table is empty then first entry not give 1 after one record saved than its showed 1 even nvl is shown to null to 0 then + 1 please correct me
thanks
If there are no rows with VOUCHER_ID = 4, then you are taking MAX over zero rows, and that is always NULL - it doesn't matter what expression you are taking the MAX over. The NVL you used will only have effect if there are rows with VOUCHER_ID = 4, but in those rows you may have NULL in the SR_NO column. It won't help if there are no rows to begin with.
You could write the code like this **:
SELECT MAX(SR_NO) INTO :CPV.SR_NO FROM CPV WHERE VOUCHER_ID=4;
:CPV.SR_NO := NVL(:CPV.SR_NO, 0) + 1;
That is - apply the NVL (and also add 1) outside the SELECT statement.
With that said - what is the business problem you are trying to solve in this manner? It looks very much like an extremely bad approach, no matter what the problem you are trying to solve is.
** Note - I haven't seen qualified bind variable names before, like :CPV.SR_NO, but since the query works for you, I assume it's OK. EDIT - I just tried, and at least in Oracle 12.2 such names are invalid for bind variables; so I'm not sure how it was possible for your code to work as posted.
ANOTHER EDIT
The whole thing can be simplified further. We just need to pull the NVL out of MAX (and also the adding of 1):
SELECT NVL( MAX(SR_NO), 0) + 1 INTO :CPV.SR_NO FROM CPV WHERE VOUCHER_ID=4;
I am trying to add rows to a grid using dhtmlx in java, following is the code.
var combinedColumn = "displayText";
displayOptionsGrid.addRow(selectedID, [ displayOptionsGrid.getRowsNum() == 0 ? 1 : 0, combinedColumn]);
What the function is supposed to do is that if the number of rows is zero it adds the first row as checked and then the rest as unchecked. The error which I am facing is, I delete the rows one by one and try to re-add the rows in the same session with some other row at first than the row I added previously, but can't. I can only add the row which I added first previously as the first row.
When I use grid.clearAll() it works fine. Can someone tell me the exact thing we do in clearAll() which we don't in deleteSelectedRows() in dhtmlxgrid. Thanks.
Please, check your selectedID attribute.
Note that each row should have a unique id, so adding a row with the id existing in your grid will break the grid.
Need help with the correct syntax. I need to determine based on 3 columns (Year, Years of Service, Terminate) if the years of service fall between the following criteria or the Terminate column has a date.
IF(["#YearsofService"]=>2,"2+ Years" else "Less than 2 Years") else Terminate(has a date) is not null. This will be for an new column displaying the criteria text.
also tried Switch function.
=SWITCH(TRUE()
[#"#YearsofService"] >=2,"2 + Years" & [#"#YearsofService"] <2, "Less Than 2 Years",
isblank([Term Date]), "Termed"
)
also tried:
IF(ISBLANK([Term Date])=false, "Termed",IF([#"#YearsofService"] >=2,"2 + Years","Less Than 2 Years"))
but does not like the If portion of statement
I think SWITCH TRUE would be the best solution for this sort of multi-test requirement. The sequence of tests after the TRUE is critical - DAX will stop evaluating after the first TRUE result is struck. So here's my attempt:
=SWITCH(TRUE()
, NOT(ISBLANK([Term Date])), "Termed"
, [#YearsofService] >=2,"2 + Years"
, [#YearsofService] <2, "Less Than 2 Years"
)
In your example you are only using two of the mentioned columns (Years of Service and Terminate). I guess the statement should look like this:
Result = IF(ISBLANK([Term Date]);IF([#"#YearsofService"]<2;"Less than 2 years";"More than 2 years");"Termed")
I have startDate and endDate parameter in my report. I need to validate them with 2 conditions. Below validation code(that not working):
=IIF((Parameters!EndDate.Value < Parameters!StartDate.Value)
AND (Parameters!EndDate.Value >
DateAdd(DateInterval.Month, 1 , Parameters!StartDate.Value)),
"Error", "")
Here first condition only works, second not working. I create TextBox and write it in value expression. What I do wrong?