cancel
Showing results for 
Search instead for 
Did you mean: 

Reading from the Table after blog, urgent

Former Member
0 Kudos

Hi, Im following this blog https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5892. [original link is broken]

I sucessfully implemented first part to my project there is a problem with second part, from comments I see that not only I do.

the code is:


try{
			
  Connection con=new SAPDBConnection().getConnection();
  Statement  st=con.createStatement();
  ResultSet rs = st.executeQuery("SELECT  * FROM SDN_USERS");
  while(rs.next())
  {
	String name=rs.getString( 1);
	byte[] b=rs.getBytes(2);
	IWDResource res=WDResourceFactory.createCachedResource(b,"MyImage",WDWebResourceType.JPG_IMAGE);
  IPrivateGeneratorView .IImageTableElement imageEle=wdContext.createImageTableElement();
  imageEle .setName( name);
 imageEle.setImage( res.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()));
			wdContext.nodeImageTable() .addElement(imageEle );
}
	
	}
	catch(Exception e){
		wdComponentAPI.getMessageManager().reportWarning(e.toString());
	}

and I get:

The method setImage(IWDResource) in the type IPrivateMyProjectView.IImageTableElement is not applicable for the arguments (String).

Is there any solution to this? Regards, Balmer

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try modifying your code to this:

imageEle.setImage(res);

Regards,

Satyajit.

Former Member
0 Kudos

Didnt help but thanks anyway. Balmer

Former Member
0 Kudos

Hi,

What is the error that you get now?

In your original code, the Image context attribute was of type IWDResource but you were setting it to the URL string of the resource, hence it was throwing an error. If you want to use the original code, make the Image attribute as String type and bind it to the "source" property of the Image UI element within the table.

Regards,

Satyajit.

Former Member
0 Kudos

I get "res is not byte[]" type. It goes fine (It looks like at least) when I do


imageEle.setImage(b);   //Image is type of binary

No error are listed but Im not able to dispaly it as a picture in an Image child of type String.

How do I conver binary,byte to a String type?

For a "Resource" type context I use


if (element.getFileResource() != null) {
	element.setImage(element.getFileResource().getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()));
}

and it works fine but I dont know how to do it in my case. Please advice, Balmer.

Edited by: Balmer on Mar 29, 2008 4:23 PM

Answers (1)

Answers (1)

Former Member
0 Kudos

Still no resolution, any advice will be most welcome. It's very urgent. Thanks in advance. Balmer