Changing abbreviation values coming for Database in ADF view Object - database

I am using ADF JDeveloper 11g Release 2
I am using Entity object called Project referring to actual database table. This table contains fileds that hold abbreviation values; for example this table have filed called STATUS that describe the current status for the project. this filed will have values like: 'A' for Approved, 'X' for Rejected, and so on.
In the interface( JSPX, or JSF Pages) I am just drag and drop the View object that refers to the Project Entity object. and the page will display the project records with their status as specified.
Question is:
Is there any way to change this observation values to the actual value somewhere; That is, Instead of having values like ( A, X,...) I want to have ( Approved, Rejected,...)

You can create a transient attribute at VO level. In the value of this attribute you can write groovy expression which will use the value of attribute named status and decode it.
Alternatively, you can alter the VO query using DECODE function by doing something like this :
SELECT name and other fields needed,
DECODE(status, 'A', 'Approved',
'X', 'Rejected',
'P', 'Pending',
'Default') decodedstatus
FROM projects;
You will need to have an additional attribute in VO in this case and can directly use the value returned by VO in UI.

Related

How can i insert a custom object into Slaesforce using Apex with requiredfields that are non-writeable?

A client has created a custom object call CustObj__c in Salesforce. They have required fields , one is Cust_Id which is of type Formula (Text)
I am trying to create a Custom Object item using the following
List<CustObj__c> CustList = new List<CustObj__c>();
CustObj__c Item_0 = new CustObj__c( Name__c='TEST1', Cust_Id='Cust: '& 123);
CustList.add(Item_0);
CustObj__c Item_1 = new CustObj__c( Name__c='TEST2', CustId__c='Cust: '& 456);
CustList.add(Item_1);
insert CustList;
But it gives the error that
Field is not writeable: CustObj__c.CustId__c
How can i insert if the field is non writeable but required ?
If it is a custom metadata object , do i need to do this ?
client hasnt provided any details
Formula fields are calculated at runtime when you view the record and are readonly, can't be marked as required. If your client has business need for it to be required they probably created a validation rule that checks the field value.
You'll have to inspect the field's formula and insert data that would satisfy it. (Some other fields populated, maybe some dates or right amounts). Maybe they assign customer id(?) in some special way, only if account reaches certain status, moves from prospect to paying customer.
You could ask them if they ever had to write unit tests that insert these records and steal get inspired by these code samples, see what prerequisites there are or fields that impact that formula.

how to assign value to lookup fields in salesforce

i have two objects KNDY4__Sales_Order__c and KNDY4__Bill_to__c.these two are linked through lookup relationship.i am trying to insert one order record as follows
`KNDY4__Sales_Order__c order=New KNDY4__Sales_Order__c();
order.KNDY4__Ship_to__c ='a14q0000001LnIeAAK';
order.KNDY4__Bill_to__r.Predicted_External_ID__c ='CN-0222741-Sold To';
order.KNDY4__Company__c ='a0l1N00000BQQKF';
Insert order;`
i am geting error as {"Object reference not set to an instance of an object."}.
how to assign values to lookup field.can anyone help me
When linking a record based on an external id, the relationship field needs to be set to an sObject with the external id, and not just the value of the id itself.
On line 3, since KNDY4__Bill_to__c is a lookup field to a custom object possibly named KNDY4__Customer__c, you should set the value of the lookup to an instance of that object, e.g.
order.KNDY4__Bill_to__r = new KNDY4__Customer__c(KNDY4__Predicted_External_ID__c ='CN-0222741-Sold To');

Pentaho salesforce upsert using externalID

I am trying to insert data in salesforce using upsert, for one field i am using the ExternalId field , i have tried many combinations but it fails...I get the error : the syntax should be object:externalId/lookupField
Any idea what is the exact syntax? Keep in mind i am inserting in table Account and the externalId field refers to Account also
object:externalId/lookupField is not very clear is it. There's a comment hidden away in the Pentaho code:
// We use an external key
// the structure should be like this :
// object:externalId/lookupField
// where
// object is the type of the object
// externalId is the name of the field in the object to resolve the value
// lookupField is the name of the field in the current object to update (is the "__r" version)
Lets say you're populating a Salesforce Object Foo__c, which has a Lookup field to Contact called Contact__c. The 'relationship name' for that lookup field would then be Contact__r.
On Contact lets say you have added an External ID called Legacy_Id__c and thats what you want to use when populating Foo__c.
What Pentaho would want in the Module Field column would then be:
Contact:Legacy_Id__c\Contact__r
The bit to the left of the slash is telling Pentaho which object/external id to map to. To the right of the slash, its telling Pentaho which lookup/relationship on Foo__c to fill in.

XMLport Table Attributes

XMLport objects in NAV appear to support table attributes (i.e. Node Type = Attribute, Source Type = Table). However, when I try to save an XMLport containing a table attribute node in NAV 2013, I get this error message:
The SourceType Table for Tag <MyTableAttribute> can only be assigned to TagType Element.
This (http://msdn.microsoft.com/en-us/library/hh165612(v=nav.70).aspx) page on MSDN seems to confirm that table attributes can be used. What purpose would a table attribute serve? What would be an example of a typical application of table attributes?
Table (record) cannot be source for attribute. Because record is a set of fields, i.e. it has multiple values, when attribute must have concrete single value. A field can be used as source for attribute of element. And record must be source for the element. That is what error message says.

cakephp setting select options and values at Model

In my database model, my attribute is set as type INT.
On the front end, I want to display a select field with representative values for the respective Integer values.
eg: [1 = Home, 2 = About]
I am currently using an external plugin for the administrating content, and the select values only allows integer. So my idea is to achieve this at respective Model. Is it possible?
Genarally yes.
You should be able to attach results of Model->find('list') to select field. Of course your model should have name or title fields for description values (Home, About).
Sounds like the kind of enum representation as I always use.
Try this solution:
http://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/
I basically uses an array matching to resolve those ints into strings in a clean way - using the model. can be the whole array for select fields or just the specific string for output in the view/index.
Its also fully form and bake-template capable.
If you name the field "attribute" in your table, and name the method "attributes()" you can easily have "cake bake" to bake this via custom templates.

Resources