Tree List Value - Passing String
apex4
database 10g EE
I have this code which will pass a value to a textfiled but only numbers. How about passing string values in a textfield? Any idea?
select case when connect_by_isleaf = 1 then 0
when level = 1 then 1
else -1
end as status,
level,
"ENAME" as title,
null as icon,
"EMPNO" as value,
"ENAME" as tooltip,
'javascript:$s("P13_EMPNO",'||EMPNO||');' as link
from "#OWNER#"."EMP"
start with "MGR" is null
connect by prior "EMPNO" = "MGR"
order siblings by "ENAME"
Hi Jose,
I believe Patrick already responded to this question on another thread: Tree List Value , where he has stated:
just use
'javascript:$s("P13_ENAME","'||ENAME||'");' as link
instead.
Regards,
Hilary
Similar Messages
-
Apex4
datbase 10g EE
Hello Apex Users,
how can I get the Value Of a tree list then pass that value to the textfield using Javascript?
Is that Possible? Hope for a quick response and answer.
regards,
joseHi Jose,
you can use the "LINK" column in the tree query to do that. Have a look at the following example which will write the clicked employee# into P13_EMPNO.
select case when connect_by_isleaf = 1 then 0
when level = 1 then 1
else -1
end as status,
level,
"ENAME" as title,
null as icon,
"EMPNO" as value,
"ENAME" as tooltip,
'javascript:$s("P13_EMPNO",'||EMPNO||');' as link
from "#OWNER#"."EMP"
start with "MGR" is null
connect by prior "EMPNO" = "MGR"
order siblings by "ENAME"Regards
Patrick
My Blog: http://www.inside-oracle-apex.com
APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf -
Passing String Which Has Single Quote Row/Value to a Function Returns Double Quoate
Hi, I'm getting weird thing in resultset. When I pass String which has single quote value in it to a split function , it returns rows with double quote.
For example following string:
'N gage, Wash 'n Curl,Murray's, Don't-B-Bald
Returns:
''N gage, Wash ''n Curl,Murray''s, Don''t-B-Bald
Here is the split function:
CREATE Function [dbo].[fnSplit] (
@List varchar(8000),
@Delimiter char(1)
Returns @Temp1 Table (
ItemId int Identity(1, 1) NOT NULL PRIMARY KEY ,
Item varchar(8000) NULL
As
Begin
Declare @item varchar(4000),
@iPos int
Set @Delimiter = ISNULL(@Delimiter, ';' )
Set @List = RTrim(LTrim(@List))
-- check for final delimiter
If Right( @List, 1 ) <> @Delimiter -- append final delimiter
Select @List = @List + @Delimiter -- get position of first element
Select @iPos = Charindex( @Delimiter, @List, 1 )
While @iPos > 0
Begin
-- get item
Select @item = LTrim( RTrim( Substring( @List, 1, @iPos -1 ) ) )
If @@ERROR <> 0 Break -- remove item form list
Select @List = Substring( @List, @iPos + 1, Len(@List) - @iPos + 1 )
If @@ERROR <> 0 Break -- insert item
Insert @Temp1 Values( @item ) If @@ERROR <> 0 Break
-- get position pf next item
Select @iPos = Charindex( @Delimiter, @List, 1 )
If @@ERROR <> 0 Break
End
Return
End
FYI: I'm getting @List value from a table and passing it as a string to split function.
Any help would be appreciated!
ZKfixed the issue by using Replace function like
Replace(value,'''''','''')
Big Thanks Patrick Hurst!!!!! :)
Though I came to another issue which I posted here:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/a26469cc-f7f7-4fb1-ac1b-b3e9769c6f3c/split-function-unable-to-parse-string-correctly?forum=transactsql
ZK -
How i pass table column value to string variable or return to java applete
Hi Master,
How do I pass a table column value into string variable. See my code below:
import java.sql.*;
public class Waheed {
public Waheed() {
public static void main (String args [])
String s = "9 23 45.4 56.7";
System.out.println ("going for connection");
// DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:@fahim:1521:aamir","muhammad","mfa786");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select accid from accbal");
System.out.println ("going for connection");
while (rset.next())
s= rset.getString("accid"); this line give me error
System.out.println (rset.getString("accid"));
System.out.println (s);
catch(Exception e){
e.printStackTrace();
This line give me an error:
s= rset.getString("accid");
s is string variable
Plese give me an idea how I can pass accid in s variable.
Thanks.
AamirSee the code sample in the following thread (try using upeercase).
JDBC connection
Kuassi -
Problem with prepared statement where cluase when passing string value.Help
I am updating a table using the following code. I am using string parameter in where clause. if I use Long parameter in where clause with ps.setLong , this code is working. Is there any special way to pass string value? Am I doing anything wrong?
===================
updateMPSQL.append("UPDATE MP_Table SET ");
updateMPSQL.append("MPRqmt = ?,End_Dt = ? ");
updateMPSQL.append("where POS = ? ");
System.out.println(updateMPSQL.toString());
con = getConnection(false) ;
ps = con.prepareStatement(updateMPSQL.toString());
ps.setLong(1,MPB.getMPRqmt());
ps.setDate(2,MPB.getEnd_Dt());
ps.setString(3,MPB.getPos());
result = ps.execute();
System.out.println("Result : " + result);
==========
Please help me.
Thanks in advance.
Regards,
Sekhardoesn't Pos look like a number rather than a string variable?
if I use Long
parameter in where clause with ps.setLong , this code
is working.
updateMPSQL.append("where POS = ? ");
ps.setString(3,MPB.getPos()); -
APEX 4.0.2 Multi-selection on a cascade LOV select list only pass 1 value
Hello everyone,
I am struggling to make a cascading LOV select list has multi-selection.
On one report page.
I have 2 select list
The first one lists the court name (P4_COURT_NAME), the second one (P4_DEFENDANT) list all defendants who currently engaged in the court.
The problem is when I allow the defendant select list become multi-select, when it submit it only pass the first selected value.
So I create just a simple select list based one list of value, and make it allow multi-selection. When it submit, the normal select list can pass selected values properly, while the cascade LOV select list pass only the first selected value.
Please help if any of you have an idea why.
We use APEX 4.0.2.00.07, Oracle data version iis 11g
The some configuration settings I set for the P4_DEFENDANT IS
Value required: Yes
Page Action When value changed: None
Allow Multi Selection: Yes
Named LOV: --Select Named LOV-
Display Extra value : Yes
Display Null Value: Yes
Null Display Value: --Select—
Null return value:
Cascading LOV Parents Items: P4_COURT_NAME
Page Items to Submit: P4_DEFENDANT
Optimize refresh: YES
List of value definition
SELECT def.first_name || ' ' || def.surname || ' (PRN: ' || def.prn || ' )' as d, def.def_id as r
FROM defendant def INNER JOIN court_engagement ce
ON def.def_id = ce.defendant_id
WHERE (ce.date_joined_aodt_court IS NOT NULL
AND (ce.date_terminated IS NULL OR to_date(ce.date_terminated,'dd/mm/yyyy') > to_date(sysdate,'dd/mm/yyyy'))
AND UPPER(ce.court_name) LIKE UPPER(:P4_COURT_NAME)
AND ce.active = 1)Source Used: Only when current value in session state is null
Source Type: Static Assignment
Maintain session state: Per session
The rest is default.
Thanks in advance.
AnnHi Chintan,
The "Source used" for those items are "Always, replacing any value in the session state". To set them to "Only when current value in session state null" sounds a good solution to me.
However, a strange thing just happened - now I will not lose the values of the items after the page reloading, although I have changed nothing in the page in my application since I asked the question. I don't understand why all of a sudden the reloading doesn't make me lose changed values any more. Let me dig it tomorrow to see what I'll find.
Thanks so much for your help.
Christine -
DRM Function to divide comma delimited string to list value
Hi
Any one knows how to seperate comma delimited string into list values.
ThanksAre you wanting to dynamically set the list values for a property? If so there are a couple options:
1. You can update them via the API.
2. You can write a sql script to update the table Property_List. This requires an application server restart and generally isn't recommended for support reasons but it makes sense in some instances.
Edited by: Naren Truelove on 16/02/2011 22:08 -
How to trace the value passed by select list
Hi,
Is it possible to know what value is passed by the select list.
eg:
:p1_testid -- is the select list name .
if select list contains 3 values ... value1, value2, and value3. and I select value2 from the select list.
I want to confirm it that the value I selected is the same value passed to the query.
- select * from Test where Testid=:p1_testid;
How to trace the value of :p1_testid before query execution.
Thanks.check your session state to see what value the select list has..
From developer tools at bottom of running page, select session, then look for the value associated with your select list..
Thank you,
Tony Miller
UTMB/EHN -
How to construct a standard rowKeyStr based on a value passed to a method ?
Hi to all im on a proyect and i really appreciate some people can help with this
looking ADF joins all use rowKey values and i need to know how to generate a standard rowKeyStr based on a value passed to an event, so it let me access any page on my Jsp ADF application and pass some values to a method and get the rowKeyStr.
i have this method actually getting the current row, how i can generate a standard rowKeyStr value.
public String myrowKeyStr(String id) {
if (id != null) {
PbeVisitasViewImpl vo = (PbeVisitasViewImpl)getPbeVisitasView1();
Key k = new Key(new Object[]{id});
Row[] found = vo.findByKey(k,1);
vo.setCurrentRow(vo.findByKey(k,1)[0]);
return someRowKeyStr;
}once you do the
Key k = new Key ( new Object[] { p1 } );
The rowkeystring comes from:
String strRowKeyStr = k.toStringFormat();
Just type k. and press ctrl-space to see the list of methods. -
How to get the viewrow value by string
Using Jdev11.1.1.5.0-adfbc-ireport3.0.0
here i'll describe: what i did.
am using jsff(dynamic region) while hitting the af:tree nodes it will opens. ok fine
i had somevo with manually wroten query. and query is fine no problem with that
here i give sample not a original query
select * from sometable where acctid = :pacctidi drag and drop the pacctid from corresponding execute params vo as selectoncechoice
static vo
Data value - account payable , advance
Data Name - ap,ad
in that jsff
*page representation*
account type : account payable (ap) - select one choice type
advance (ad) - select one choice type
like this some select once choice and some inputs.
Run report - command button
.jsff code
<af:selectOneChoice value="#{bindings.ACCT_TYPE.inputValue}"
label="Account Type"
shortDesc="#{bindings.ACCT_TYPE.hints.tooltip}"
id="soc3" required="true"
autoSubmit="true"
binding="#{backingBeanScope.SUP1040V.soc3}"
valuePassThru="true"
valueChangeListener="#{backingBeanScope.SUP1040V.ValueChangeListener1}">
<f:selectItems value="#{bindings.ACCT_TYPE.items}" id="si3"/>
</af:selectOneChoice>
<af:commandToolbarButton text="Export in pdf" id="ctb2">
<af:fileDownloadActionListener method="#{backingBeanScope.SUP1040V.Report}"
/>
</af:commandToolbarButton>.java
//while hitting the button following logs are appeared i show it as commented format.
public void Report(FacesContext context, OutputStream out) throws IOException,Exception
FacesContext ctx = FacesContext.getCurrentInstance();
HttpServletRequest request =
(HttpServletRequest)ctx.getExternalContext().getRequest();
HttpServletResponse response =
(HttpServletResponse)ctx.getExternalContext().getResponse();
BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry();
System.out.println("print binding" +bindings1 );
//while using sop i get this in my log : : print binding ReportsPageFragments_SUP1040VPageDef_WEB_INF_TaskFlows_SUP1040_V_TF_xml_SUP1040_V_TF
JUCtrlListBinding listBinding1 = (JUCtrlListBinding)bindings1.get("ACCT_TYPE");
System.out.println("print list bindings" +listBinding1 );
//while using sop i get this in my log : : print list bindings0
Object selectedValue1 = listBinding1.getSelectedValue();
System.out.println("print selected value" + selectedValue1);
//while using sop i get this in my log : : print selected valueViewRow [oracle.jbo.Key[AP ]]
request.setAttribute("ACCT_TYPE", //here i want the value "AP" in String );
if i use like this means
request.setAttribute("ACCT_TYPE", soc1.getValue() ); i get the index value.
i need the dataname "ap" so i go above method which say wrotes ...
request.getRequestDispatcher(response.encodeURL("/sup1040servlet")).forward(request,response);
System.out.println("hihihihih");
response.flushBuffer();
ctx.responseComplete();
public void ValueChangeListener1(ValueChangeEvent valueChangeEvent) {
// Add event code here...
String AcctType = valueChangeEvent.getNewValue().toString();
System.out.println("AcctType" + AcctType);
FacesContext contxt = FacesContext.getCurrentInstance();
valueChangeEvent.getComponent().processUpdates(contxt);
BindingContainer bindings1 =
BindingContext.getCurrent().getCurrentBindingsEntry();
// Get the sepecific list binding
JUCtrlListBinding listBinding1 =
(JUCtrlListBinding)bindings1.get("ACCT_TYPE");
// Get the value which is currently selected
Object selectedValue1 = listBinding1.getSelectedValue();
System.out.println(selectedValue1);
}if i get ap means my report runs. or else it will shows empty page.
how to get the viewrowimpl class value as string.
Edited by: ADF7 on Mar 24, 2012 7:27 AMADF7,
I'm not sure I understand what you are up to.
As far as I understand you want to get the display value instead of the index
I use this code
public void StatusChangedListener(ValueChangeEvent valueChangeEvent)
BindingContext lBindingContext = BindingContext.getCurrent();
BindingContainer lBindingContainer = lBindingContext.getCurrentBindingsEntry();
JUCtrlListBinding list = (JUCtrlListBinding) lBindingContainer.get("Status");
int newindex = (Integer) valueChangeEvent.getNewValue();
Object row = list.getDisplayData(); // Wichtig um die liste zu laden!!!!
Row lFromList = (Row) list.getValueFromList(newindex);
Object lAttribute = lFromList.getAttribute("Value");
String newVal = (String) lAttribute;
}to get the value from a selectOneChoice component...
Timo -
Version: Jdeveloper 11.1.2.1.0
how to get programmatically tree node value.
i have tried but cann't read value from selected node.
please help me.
here is my application creation steps:
1. New Application
2. Fusion Web Application (ADF) Template
3. Create View Object VOTreeMst
Query:
Select Department_Name,Department_Id
From Departments
4. Create View Object VOTreeChd
Query:
Select Last_Name,Employee_Id,Department_Id
From Employees
5. Create View Link VLTreeMstChd
VOTreeMst.DepartmentId=VOTreeChd.DepartmentId
And Add to Application Module
6. Create page page1 in ViewController
New-->Web Tier-->JSF/Facelets-->Page
Selected Document Type JSP XML
7. Drag VOTreeMst1 From Data Controls into page1
and select Tree-->ADF Tree
8. ADD java Code into selection Listener
public void nodeSelect(SelectionEvent selectionEvent) {
//original selection listener set by ADF
String adfSelectionListener = "#{bindings.VOTreeMst1.treeModel.makeCurrent}";
//make sure the default selection listener functionality is preserved.
//you don't need to do this for multi select trees as the ADF binding
//only supports single current row selection
/* START PRESERVER DEFAULT ADF SELECT BEHAVIOR */
FacesContext fctx = FacesContext.getCurrentInstance();
Application application = fctx.getApplication();
ELContext elCtx = fctx.getELContext();
ExpressionFactory exprFactory = application.getExpressionFactory();
MethodExpression me = null;
me = exprFactory.createMethodExpression(elCtx, adfSelectionListener, Object.class,
new Class[] { SelectionEvent.class });
me.invoke(elCtx, new Object[] { selectionEvent });
/* END PRESERVER DEFAULT ADF SELECT BEHAVIOR */
RichTree tree = (RichTree)selectionEvent.getSource();
TreeModel model = (TreeModel)tree.getValue();
//get selected nodes
RowKeySet rowKeySet = selectionEvent.getAddedSet();
Iterator rksIterator = rowKeySet.iterator();
//for single select configurations, thi sonly is called once
while (rksIterator.hasNext()) {
List key = (List)rksIterator.next();
JUCtrlHierBinding treeBinding = null;
CollectionModel collectionModel = (CollectionModel)tree.getValue();
treeBinding = (JUCtrlHierBinding)collectionModel.getWrappedData();
JUCtrlHierNodeBinding nodeBinding = treeBinding.findNodeByKeyPath(key);
Row rw = nodeBinding.getRow();
//print first row attribute. Note that in a tree you have to determine the node
//type if you want to select node attributes by name and not index
String rowType = rw.getStructureDef().getDefName();
if(rowType.equalsIgnoreCase("VOTreeMst")){
System.out.println("This row is a department: " + rw.getAttribute("DepartmentId"));
else if(rowType.equalsIgnoreCase("VOTreeChd")){
System.out.println("This row is an employee: " + rw.getAttribute("EmployeeId"));
else{
System.out.println("Huh ????");
// ... do more usefuls stuff here
9. when i click on first node it is working but i click on second node it is not working
error message::
<LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5
javax.el.ELException: java.lang.NullPointerException
at com.sun.el.parser.AstValue.invoke(Unknown Source)
at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1589)
at org.apache.myfaces.trinidad.component.UIXTree.broadcast(UIXTree.java:237)
<RegistrationConfigurator> <handleError> ADF_FACES-60096:Server Exception during PPR, #1
javax.el.ELException: java.lang.NullPointerException
I have also tried using following code but same problem
public void onTreeSelect(SelectionEvent selectionEvent) {
//original selection listener set by ADF
String adfSelectionListener = "#{bindings.VOTreeMst1.treeModel.makeCurrent}";
//make sure the default selection listener functionality is preserved.
//you don't need to do this for multi select trees as the ADF binding
//only supports single current row selection
/* START PRESERVER DEFAULT ADF SELECT BEHAVIOR */
FacesContext fctx = FacesContext.getCurrentInstance();
Application application = fctx.getApplication();
ELContext elCtx = fctx.getELContext();
ExpressionFactory exprFactory = application.getExpressionFactory();
MethodExpression me = null;
me = exprFactory.createMethodExpression(elCtx, adfSelectionListener, Object.class,
new Class[] { SelectionEvent.class });
me.invoke(elCtx, new Object[] { selectionEvent });
/* END PRESERVER DEFAULT ADF SELECT BEHAVIOR */
RichTree tree = (RichTree)selectionEvent.getSource();
TreeModel model = (TreeModel)tree.getValue();
//get selected nodes
RowKeySet rowKeySet = selectionEvent.getAddedSet();
Iterator rksIterator = rowKeySet.iterator();
//for single select configurations, thi sonly is called once
while (rksIterator.hasNext()) {
List key = (List)rksIterator.next();
JUCtrlHierBinding treeBinding = null;
treeBinding = (JUCtrlHierBinding)((CollectionModel)tree.getValue()).getWrappedData();
JUCtrlHierNodeBinding nodeBinding = treeBinding.findNodeByKeyPath(key);
Row rw = nodeBinding.getRow();
//print first row attribute. Note that in a tree you have to determine the node
//type if you want to select node attributes by name and not index
System.out.println("row: " + rw.getAttribute(0));
But
If i create .jspx page From
Web Tier->Jsp->page Then it is working fine
when i create .jspx page From
Web Tier->JSF\Facelets->page Then it is not working
i need to get value from "Web Tier->JSF\Facelets->page"
is there any help please?You should try Franks generic selectionListener http://www.oracle.com/technetwork/developer-tools/adf/learnmore/25-generic-tree-selection-listener-169164.pdf. For help on hoe to get the selected tree node data check http://www.oracle.com/technetwork/developer-tools/adf/learnmore/26-get-selected-tree-node-data-169165.pdf
Timo -
ALV Tree list output using the Class and method
Hi,
How to get the internal table values of ALV Tree List in classes.
My requirement is i need to store the output values in Ztable of a SAP Transaction of CK86_99.
for this, i copied the SAP Standard Transaction into Z tcode and i am trying to poplulate the output display into Ztable. But this standard tcode CK86_99 is using the classes of ALV tree list to display output.
CL_STRUCTURE_EXPLOSION_TREE -- Class
CONSTRUCTOR - method
Finally in the above mentioned method, i am able to see the output values of ALV tree list in the internal table of mt_output_table.
But these are SAP Standard Class and method.
My doubt is, How to get these internal table values in my Zprogram.
is there any user exit or badi can we use in the method of class???? Actually my system is 4.6C
Please suggest me on this problem.
Thanks in advance
KBS ReddyFirst your getInstance() method returns 'singleton' which you havent declared/init anywhere.
your getAll() method needs to be static if you need to call it the way you are doing.
In your getAll() method u are passing a parameter called patientRecord ... where have you declared/init it.
i think you have to do something like this ... if i have understood you correctly.
/* THIS IS IN YOUR SERVLET*/
Collections c = database.getAll();
out.println(C);
/* YOUR FlatfileDatabase CLASS HAS SOMETHING LIKE THIS*/
public static FlatfileDatabase getInstance() {
return new FlatfileDatabase();
public static Collections getAll() { -
Hi,
I created a simple plugin and since i wanted to use Early Binding i added Xrm.cs file to my solution.After i tried registering the plugin (using the Plugin Registration Tool) the plugin does not gets registered and i get the below mentioned Exception.
Unhandled Exception: System.TimeoutException: The request channel timed out while waiting for a reply after 00:01:59.9139778. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this
operation may have been a portion of a longer timeout.
Server stack trace:
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Xrm.Sdk.IOrganizationService.Update(Entity entity)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.UpdateCore(Entity entity)
at Microsoft.Crm.Tools.PluginRegistration.RegistrationHelper.UpdateAssembly(CrmOrganization org, String pathToAssembly, CrmPluginAssembly assembly, PluginType[] type)
at Microsoft.Crm.Tools.PluginRegistration.PluginRegistrationForm.btnRegister_Click(Object sender, EventArgs e)
Inner Exception: System.TimeoutException: The HTTP request to 'https://demoorg172.api.crm.dynamics.com/XRMServices/2011/Organization.svc' has exceeded the allotted timeout of 00:01:59.9430000. The time allotted to this operation may have been a portion of a
longer timeout.
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
Inner Exception: System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
And to my Surprise after i remove the Xrm.cs file from my solution the Plugin got registered!
Not understanding what exactly is the issue.
Any Suggestions are highly appreciated.
Thanks,
Shradha
Hello Shardha,
I really appreciate that you have faced this issue.This is really very strange issue and basically it occurs because of big size of your early bound class and slow internet
connection.
I would strictly recommend you to reduce the file size of your early bound class and then register.By default early bound class is created for all the entities which are
present in CRM(System entities as well custom entities).Such kind of early bound classes takes lots of time to register on server and hence timeout exception comes.
There is some standard define to reduce the size of early bound class.Please follow the link to get rid from big size of early bound class.
Create a new C# class library project in Visual Studio called SvcUtilFilter.
In the project, add references to the following:
CrmSvcUtil.exe(from sdk) This exe has the interface we will implement.
Microsoft.Xrm.Sdk.dll (found in the CRM SDK).
System.Runtime.Serialization.
Add the following class to the project:
using System;
using System.Collections.Generic;
using System.Xml.Linq;
using Microsoft.Crm.Services.Utility;
using Microsoft.Xrm.Sdk.Metadata;
namespace SvcUtilFilter
/// <summary>
/// CodeWriterFilter for CrmSvcUtil that reads list of entities from an xml file to
/// determine whether or not the entity class should be generated.
/// </summary>
public class CodeWriterFilter : ICodeWriterFilterService
//list of entity names to generate classes for.
private HashSet<string> _validEntities = new HashSet<string>();
//reference to the default service.
private ICodeWriterFilterService _defaultService = null;
/// <summary>
/// constructor
/// </summary>
/// <param name="defaultService">default
implementation</param>
public CodeWriterFilter( ICodeWriterFilterService defaultService )
this._defaultService = defaultService;
LoadFilterData();
/// <summary>
/// loads the entity filter data from the filter.xml file
/// </summary>
private void LoadFilterData()
XElement xml = XElement.Load("filter.xml");
XElement entitiesElement = xml.Element("entities");
foreach (XElement entityElement in entitiesElement.Elements("entity"))
_validEntities.Add(entityElement.Value.ToLowerInvariant());
/// <summary>
/// /Use filter entity list to determine if the entity class should be generated.
/// </summary>
public bool GenerateEntity(EntityMetadata entityMetadata, IServiceProvider services)
return (_validEntities.Contains(entityMetadata.LogicalName.ToLowerInvariant()));
//All other methods just use default implementation:
public bool GenerateAttribute(AttributeMetadata attributeMetadata, IServiceProvider services)
return _defaultService.GenerateAttribute(attributeMetadata, services);
public bool GenerateOption(OptionMetadata optionMetadata, IServiceProvider services)
return _defaultService.GenerateOption(optionMetadata, services);
public bool GenerateOptionSet(OptionSetMetadataBase optionSetMetadata, IServiceProvider services)
return _defaultService.GenerateOptionSet(optionSetMetadata, services);
public bool GenerateRelationship(RelationshipMetadataBase relationshipMetadata, EntityMetadata otherEntityMetadata, IServiceProviderservices)
return _defaultService.GenerateRelationship(relationshipMetadata, otherEntityMetadata, services);
public bool GenerateServiceContext(IServiceProvider services)
return _defaultService.GenerateServiceContext(services);
This class implements the ICodeWriterFilterService interface. This interface is used by the class generation
utility to determine which entities, attrributes, etc. should actually be generated. The interface is very simple and just has seven methods that are passed metadata info and return a boolean indicating whether or not the metadata should be included
in the generated code file.
For now I just want to be able to determine which entities are generated, so in the constructor I read from an XML
file (filter.xml) that holds the list of entities to generate and put the list in a Hashset. The format of the xml is this:
<filter>
<entities>
<entity>systemuser</entity>
<entity>team</entity>
<entity>role</entity>
<entity>businessunit</entity>
</entities>
</filter>
Take a look at the methods in the class. In the GenerateEntity method, we can simply check the EntityMetadata parameter
against our list of valid entities and return true if it's an entity that we want to generate.
For all of the other methods we want to just do whatever the default implementation of the utility is. Notice
how the constructor of the class accepts a defaultService parameter. We can just save a reference to this default service and use it whenever we want to stick with the default behavior. All of the other methods in the class just call the default
service.
To use our extension when running the utility, we just have to make sure the compiled DLL and the filter.xml file
are in the same folder as CrmSvcUtil.exe, and set the /codewriterfilter command-line argument when running the utility (as described in the SDK):
crmsvcutil.exe /url:http://<server>/<org>/XrmServices/2011/Organization.svc /out:sdk.cs /namespace:<namespace> /codewriterfilter:SvcUtilFilter.CodeWriterFilter,SvcUtilFilter
/username:[email protected] /password:xxxx
That's it! You now have a generated sdk.cs file that is only a few hundred kilobytes instead of 5MB.
One final note: There is actually a lot more you can do with extensions to the code generation utility.
For example: if you return true in the GenerateOptionSet method, it will actually generated Enums for each CRM picklist (which it doesn't normally do by default).
Also, the source code for this SvcUtilFilter example can be found here.
Use at your own risk, no warranties, etc. etc.
Please mark as a answer if this post is useful to you. -
Pass String[] (String Array) type to a parameter in "Edit Action Binding"
Hi
Hope you are doing fine. This is very important to me, kindly help me in this regad.
I have a scenario where I need to pass in a parameter of type String[] that has only one value {"Name"} to a webservice that returns some values.
I've created a WS datacontrol, dragged and dropped the return value on to a jspx, then it asks me to give the input value
How do I pass it to the Parameter in "Edit Action Binding"?
When I say new String[]{"Name"}, it gives me the following error
Cannot create an object of type:[Ljava.lang.String; from type:java.lang.String with value:new String[]{"Name"}
Similarly, I hardcoded this value in a managedBean, added it to requestScope/applicationScope and queried it using #{applicationScope.AppCreationBean.epsName}
But this time, it says, the value is null. I guess the value is not getting initialized properly. But if i hardcode the value in the getter method, I'm again getting the error as above.
Would some one tell me how to pass an array of type String (ie, String[]) with a value "Name" in the "Edit Action Binding" wizard itself?
Regards
RaviKiranHi Frank
Thanks for the reply.
Issue resolved by initializing it in the ManagedBean.
For some reason, when I put it in request/application scopes, it was coming as null, but when I registered the Bean in PageFlowScope, it was working!
Regards
RaviKiran -
How to get a Tree Node Value when a Tree is Expanded
My reqiurement is when i Expand a Tree i need the Expanded tree Node Value. For Example Consider Parent as a Root Node of a Tree, and Consider its two Children Child1 and Child2.
When + Parent Expanded
I will Get the Output as --Parent
- Child1
- Child2
so As when i expand the Tree i must Get the String Value Parent.duplicate
How to get a Tree Node Value when a Tree is Expanded
Maybe you are looking for
-
TS2771 Why isn't the iTunes Store working on my iPod touch
Every time it try to download and app it said iTunes Store not available
-
Is it possible to set gray scaled printing as default?
When a user clicks on the print button in a PDF, the gray scaled printing checkbox is unchecked. Is it possible to set that checkbox checked when a user clicks on the print button?
-
Hello, What is the process of subcontracting in Project systems.Please explain with steps.
-
Connecting Coherence cache from C++ client
hi, We are trying to connect c++ clients to coherence server running in java. do we need to make any specific changes ? we just tried to load the coherence-client.xml used for java clients in c++. but it doesnt seem to work.. we are getting below err
-
Add Internal Table Multiple Lines into Single Line
Hi Gurus, Before post this thread, i hav searched SDN but i could not find the exact solution. I hav an internal table, i want to add the records of this internal table into single line (string variable), separated by tab operator. can any one give m