Skip to main content

Hi, 

 

 

I m trying to save an image into DB through  item view and then wanted to displayed it in List View in a same form.

I have used an SmartObject field to store the image into DB.

 

But its giving an error while loading the form.

 

Error.: Object reference not set to an instance of an object.

 

Any help will be apprciated highly.

 

Thanks and Regards

Ruchi 

Dear ,

 

That error is caused by smartobect , could u try goin to the tester utility tool , refresh the SQL service instance , and recreate/update the smartobject u r using in this form ?

 

Hope this helps!

Regards.


Hi Ahmad

 

 

Thanks for replying .

 

I have try to execute that smartObject List method , through which data is populated in List View  so it was successfully executed .

The error is coming when i tried to open the form.

 

Can you please let me know what are the steps to store an image in db and then populate into another Lits view. It would be very helpful for me.

 

Thanks in Advance !!!!!

 

Regartds

Ruchi


Dear ,

 

Lets say u wanna create itemview to save an image , and show that saved images in list view ,

oh well ,

 

1- DB table needed with following fields , ID->Primary , AttachmentFile--> NVARCHAR(MAX) ,

Go create an item and list view off these 2 , make sure u r using attachment control in the itemview ,

also go to that specific smartobject and make sure its type is "File" , if its not , just change it to file type ,

2-on the item view , use the attachment control to upload a file , and add a button to execute creation for the smartobject method "Create"

and pass the attachment control as input parameter for "AttachmentFile" field .

after that execute list refresh on the list view to show the saved data  ,

 

hope it helps ur scenario  ,

Regards.


Hi Ahmad,

 

Thanks for the reply.

I have tried to take "File" type as a smartobject property and nvarchar(max) for the same in database , but still image is'nt working as expected .

I have tried all the possibility .

Can you please tell me how can we save the URL of image in db and then retirve it from db and showed it in list view.

 

 

Thanks in Advance !!!!!

 

Regards

Ruchi

 

 

 


Dear , 

 

Its not a URL , and its not something u "do" , its done auto if u were using file/image attachment control ,

they will be saved as "Base 64" , and if u wanna show them in a list , u can do that if u set the column property "Field" as File/Image

 

follow these steps hope they get u where u want ,

 

1-Create smartobject based on smartbox service called ImageFile ,

Add 2 fields , 

a-Name : FileAttachment , Type:File

b-Name: ImageAttachment , Type:Image

 

Generated 2 views off of them , use "Generate" not "design"

1-item view 

2-list view

 

then test it , open ur item view , add 1 file and 1 image and press on "Create" , 

both of them will be saved under ur K2 DB , called ,dbo].ImageFile

After u save the file and image , go and run ur Item list , u will find that they r shown and clickable to download ,

 

What happens is this , File/Image attachment controls saves them as "base 64" , and when a list column has Field Type : File or Image , it will auto render them .

 

Hope it helps and not boring , 

Regards.

 


Reply