Skip to main content

Posts

Showing posts from March, 2011

Stupid view criteria with an and criteria not working

Note to self : When creating a bind variable enabled criteria follow the following steps so you have no hassles. 1) Create LOV with straight sql (no bind variables in sql) or you will get a bind variable not bound error. 2) Create criteria (DONT use a criteria in your mappings create multiple criteria). This avoids parameter not found in sql error. 3) Apply all criteria to attribute lov mapping (View Accessors, edit, blue button to move). Then map your bind variable to a value ie if you have a attribute called Code in the VO you can just write Code in the value section. 4) If you want you can set a hint on the bind variable to hide it in the LOV. DONE!!!

Hunting the elusive panellabelandmessage padding

I have a panelformlayout and with panellabelandmessages and various other stuff in it. My alignment of fields is screwed because my plam items are left padded by 9px. Why I dont know. So I decided to pad all the other items by 9px to keep it all looking good. (the plam items seem like they are hard codex to 9px or something). So I add a style class to the other items called leftPad but the style doesnt work. So I added a background color to my style to check if I got my items correct and like magic the padding and the color work. So I just changed the background back to the original color and everything works - like magic. Styled item <af:inputtext columns="#{bindings.Attr1.hints.displayWidth}" id="it25" label="#{bindings.Attr1.hints.label}" maximumlength="#{bindings.Attr1.hints.precision}" required="true" shortdesc="#{bindings.Attr1.hints.tooltip}" styleclass="leftPad" value="#{bindings.

List of values as one item for form layout - And lov key and description lookup

This is a quick and dirty so take note of the downside: 0) Create LOV based on sql query and map lov in your vo. 1) Add transient attribute based on sql query to your vo. (tick mapped to column or sql or and selected in query tick boxes) 2) Enter alias and sql query (Expression) in (makes sure your where clause maps one column of the vo to a column in that table). Select t.desc from table t where t.code = CodeInVO 3) Add an addtional mapping in your LOV setting in your vo attribute and map it (green button to add and select the correct values in the drop down) to your newly created transient. see below for the formatting of this LOV if you are using a panelFormLayout and you want it to be layed out as one entry in the panel form. <af:panelLabelAndMessage id="plam11" label="#{bindings.Attrib1.hints.label}"> <af:panelGroupLayout layout="horizontal" id="pgl7"> <af:inputListOfValues id="attrib1Id" popu

Dynamic datasource selection/ swapping ADF

Just did this for a quick poc so pleased adapt this code as is is not production suitable. 1) Create a factory package za.poc; import oracle.jbo.server.DatabaseTransactionFactory; public class CustomDatabaseTransactionFactory extends DatabaseTransactionFactory { public CustomDatabaseTransactionFactory() { super(); } public oracle.jbo.server.DBTransactionImpl2 create() { return new CustomTransaction(); } } 2) Create new Transaction class package za.poc; import oracle.adf.share.ADFContext; import oracle.jbo.server.DBTransactionImpl2; public class CustomTransaction extends DBTransactionImpl2 { public CustomTransaction() { super(); } public void connectToDataSource(java.util.Hashtable p1, java.lang.String p2, java.lang.String p3, java.lang.String p4, boolean p5) { String userName = (String)ADFContext.getCurrent() .getSessionScope().get("USER_NAME"); if (userName != null) { if ("test&quo

Converting forms logic

ORA-00936-Missing-Expression Make sure you havent done a search and replace through your code of IS NULL and replaced your sql code with ==. I am really going to have to write a generator for this stuff.