Home » Fusion Middleware & Colab Suite » Business Intelligence » validation rule
validation rule [message #646634] Wed, 06 January 2016 02:22 Go to next message
f.h.kash
Messages: 6
Registered: January 2016
Junior Member
Hi

i have 2 entity

1_name is=fin and have one field (centvalue)
2_name is=optain and have 3 field (cent value and optainedcentvalue and centvalueT(is transient and calculated fin.centvalue and set in optain.centvalue) )
2 entity have assoc whit id

how to validation rule for check value optain.centvalue >= optain.optainedcentvalue ??
Re: validation rule [message #646636 is a reply to message #646634] Wed, 06 January 2016 02:35 Go to previous messageGo to next message
Michel Cadot
Messages: 65254
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Welcome to the forum.
Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Also always post your Oracle version, with 4 decimals.

With any SQL or PL/SQL question, please, Post a working Test case: create table (including all constraints) and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.

Quote:
how to validation rule for check value optain.centvalue >= optain.optainedcentvalue ??


Add a check constraint on your table: "check (centvalue >= optainedcentvalue)".

Re: validation rule [message #646638 is a reply to message #646636] Wed, 06 January 2016 02:56 Go to previous messageGo to next message
f.h.kash
Messages: 6
Registered: January 2016
Junior Member
Thank
My language is not English.I am Sorry Sad


Your answer does not solve the problem,Because I can not get the calcuted field(optained.centvalue)

Thank
Re: validation rule [message #646639 is a reply to message #646638] Wed, 06 January 2016 03:00 Go to previous messageGo to next message
Michel Cadot
Messages: 65254
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

We have a common language: SQL
So please read the links I gave you and post a test case to explain and show us your question.
Don't forget to specify your Oracle version.

[Updated on: Wed, 06 January 2016 03:00]

Report message to a moderator

Re: validation rule [message #646640 is a reply to message #646639] Wed, 06 January 2016 03:08 Go to previous messageGo to next message
f.h.kash
Messages: 6
Registered: January 2016
Junior Member
Ok

Thank
Re: validation rule [message #646666 is a reply to message #646640] Wed, 06 January 2016 12:39 Go to previous messageGo to next message
f.h.kash
Messages: 6
Registered: January 2016
Junior Member
Good time
entity FinDoc:
<Attribute
Name="FinDocId"
IsNotNull="true"
ColumnName="FIN_DOC_ID"
SQLType="NUMERIC"
Type="oracle.jbo.domain.Number"
ColumnType="NUMBER"
TableName="FIN_DOC"
PrimaryKey="true">
<Properties>
<CustomProperties>
<Property
Name="SequenceName"
Value="FIN_DOC_SEQ"/>
</CustomProperties>
<SchemaBasedProperties>
<DISPLAYWIDTH
Value="15"/>
</SchemaBasedProperties>
</Properties>
</Attribute>

<Attribute
Name="OptainId"
IsNotNull="true"
ColumnName="OPTAIN_ID"
SQLType="NUMERIC"
Type="oracle.jbo.domain.Number"
ColumnType="NUMBER"
TableName="FIN_DOC"
PrimaryKey="true">
<Properties>
<SchemaBasedProperties>
<DISPLAYWIDTH
Value="15"/>
</SchemaBasedProperties>
</Properties>
</Attribute>

<Attribute
Name="CentValue"
ColumnName="CENT_VALUE"
SQLType="NUMERIC"
Type="oracle.jbo.domain.Number"
ColumnType="NUMBER"
TableName="FIN_DOC"
DefaultValue="0"
IsNotNull="true">
<Properties>
<SchemaBasedProperties>
<LABEL
ResId="CENT_VALUE"/>
<DISPLAYWIDTH
Value="15"/>
</SchemaBasedProperties>
</Properties>
</Attribute>

Entity Optain:
<Attribute
Name="OptainId"
IsNotNull="true"
ColumnName="OPTAIN_ID"
SQLType="NUMERIC"
Type="oracle.jbo.domain.Number"
ColumnType="NUMBER"
TableName="OPTAIN"
PrimaryKey="true">
<Properties>
<CustomProperties>
<Property
Name="SequenceName"
Value="OPTAIN_SEQ"/>
</CustomProperties>
<SchemaBasedProperties>
<DISPLAYWIDTH
Value="15"/>
</SchemaBasedProperties>
</Properties>
</Attribute>
<Attribute
Name="CentValueT"
ColumnName="CENT_VALUE_T"
SQLType="NUMERIC"
Type="oracle.jbo.domain.Number"
ColumnType="NUMBER"
IsPersistent="false"
IsQueriable="false"
IsUpdateable="false">
<TransientExpression
trustMode="untrusted"><![CDATA[Number val=FinDoc.sum("CentValue");
return (val!=null ? val : 0)]]></TransientExpression>
<RecalcCondition
trustMode="untrusted"><![CDATA[true]]></RecalcCondition>
</Attribute>
<Attribute
Name="CentValue"
ColumnName="CENT_VALUE"
SQLType="NUMERIC"
Type="oracle.jbo.domain.Number"
ColumnType="NUMBER"
TableName="OPTAIN"
DefaultValue="0"
IsNotNull="true">
<RecalcCondition
trustMode="untrusted"><![CDATA[true]]></RecalcCondition>
<Properties>
<CustomProperties>
<Property
Name="ValueField"
Value="CentValueT"/>
</CustomProperties>
<SchemaBasedProperties>
<LABEL
ResId="CENT_VALUE"/>
<DISPLAYWIDTH
Value="15"/>
</SchemaBasedProperties>
</Properties>
</Attribute>

caiculated for set field:
private boolean OptainedCentValueChanged = false;


public void setOptainedCentValue(Number value) {
Number oldValue = getOptainedCentValue();
if (oldValue == null) {
if (value != null) {
setAttributeInternal(OPTAINEDCENTVALUE, value);
OptainedCentValueChanged = true;
}
} else if (value == null || value.compareTo(oldValue) != 0) {
setAttributeInternal(OPTAINEDCENTVALUE, value);
OptainedCentValueChanged = true;
}
}


@Override
public void afterCommit(TransactionEvent transactionEvent) {
super.afterCommit(transactionEvent);
if (OptainedCentValueChanged) {
BdgPlnCreditGroupImpl bdgPlnCreditGroup = this.getBdgPlnCreditGroup();
if (bdgPlnCreditGroup.getCurrencyId() == null) {
bdgPlnCreditGroup.setOptainedCentValue(null);
} else {
bdgPlnCreditGroup.setCurrencyOptainedCentValue(null);
}
OptainedCentValueChanged = false;
}
private boolean CentValueChanged = false;
public void setCentValue(Number value) {
Number oldValue = getCentValue();
if (oldValue == null) {
if (value != null) {
setAttributeInternal(CENTVALUE, value);
CentValueChanged = true;
}
} else if (value == null || value.compareTo(oldValue) != 0) {
setAttributeInternal(CENTVALUE, value);
CentValueChanged = true;
}
}


private boolean CentValueChanged = false;
public void setCentValue(Number value) {
Number oldValue = getCentValue();
if (oldValue == null) {
if (value != null) {
setAttributeInternal(CENTVALUE, value);
CentValueChanged = true;
}
} else if (value == null || value.compareTo(oldValue) != 0) {
setAttributeInternal(CENTVALUE, value);
CentValueChanged = true;
}
}



I could not solve Sad sorry
I want validation for check (Centvalue <= Optainedcentvalue).how?
You can help؟
Re: validation rule [message #646667 is a reply to message #646666] Wed, 06 January 2016 12:41 Go to previous messageGo to next message
f.h.kash
Messages: 6
Registered: January 2016
Junior Member
oracle fusion middleware 12g
Re: validation rule [message #646804 is a reply to message #646667] Sat, 09 January 2016 13:58 Go to previous message
f.h.kash
Messages: 6
Registered: January 2016
Junior Member
Hi
How to use oldvalue and newvalue?

These methods solve the problem?
Previous Topic: where to download Oracle Translation Builder?
Next Topic: Help with SQL Syntax
Goto Forum:
  


Current Time: Thu Dec 14 17:07:48 CST 2017

Total time taken to generate the page: 0.01800 seconds