SoultionModel with Blob Loader

Hi,

I am trying to figure out to attach an image from my database to a label using the solution model.

During one of the webinars Bob Cusick said to use the blob loader to achieve this. I have tried several things but I still can’t seem to figure it out.

Here is my string for the blob loader:

“media:///servoy_blobloader?servername=testsvr&tablename=buttons&dataprovider=mainimage&rowid=1”;

I tried using a label on a form and setting it’s imageMedia to that path and it worked ok, so I think I have the string above ok.

It’s when setting the label I create on using the solution model that I get into trouble. I can create my new form fine, and create a new label but I either can’t get the image to show or it throws an error.

I have tried it so many different ways so this code may be way off.

var myForm = solutionModel.newForm('form1', 'tstsvr', 'buttons', tstsvr', false, 800, 600)

var btn1 = myForm.newLabel('Btn',200,21,100,100)
var btnimage = solutionModel.getMedia("media:///servoy_blobloader?servername=testsvr&tablename=buttons&dataprovider=mainimage&rowid=1")
btn1.imageMedia = btnimage
   
 application.showFormInDialog('form1',-1,-1,-1,-1,'test',false,false,'test',true)

The form opens but the image is not shown

Thanks!

this will not work.
You can’t use the blobloader in the solution model. Because you also cant do that in the designer.

solutionModel.getMedia(name) will only return something if that media is in the solution model that you can get by name.
that you then can use.

Currently the runtime property setImageURL(url) isnt accessible in the design/solution model components.

So would there be any other way to set a label or buttons image and rolloverImage from an image stored in a database field? Or do I have to store all of the images I want to use the main image media area?

Basically what I am trying to do is have a table with all of the properties of a button (name, image, rolloverImage, etc) and then be able to dynamically create the buttons.

I had this working before but since you can’t change the rolloverImage in a method I was hoping the Solution Model would achieve that.

Thanks

no that is currently not possible.

for rollover we dont have a runtime property (yet) and the design time property is a media id, so a solution media not something from the outside.

Hi

Using the designer: Can I set an image media to a media defined in a required module?

I currently have the problem that all settings for image media are unresolved and I guess it is because we defined most of the media in the basic module. Probably they cannot be accessed by other solutions. Is this correct?

Thanks for any help and regards
Birgit

We routinely use one module for all media. Importing 3.5 solutions to 4.1 set up with a media module does not give us unresolved links. The only way I can think of you getting this is if you did a clean import of your solution without the media module then included the media module after the fact. Maybe circular references to included modules (parent > media > parent) might confuse the import process as well.

yes as david says that must work fine
The only thing is does the solution that wants to use the media , really have that media solution as one of its modules (or a module of a module)

4.x is must stricter in that. Solutions really can get to stuff they can access on there own (if you see them stand alone as the main solution)

Thanks for the replies.

We did not a clean import. (We once did and encoutered problems).

I cannot guarantee that all references between modules are correct. But since we used modules before and were aware of the problems cross references would result in, we were seriously building a clean module hierarchy (see my previous posts regarding cross references between forms and modules).

All solutions of the ‘second’ level - meening, they include only the basic module with all the media and value lists and relations in it - have lost the settings for image media. An easy solution hierarchy though.

We also have the warnings about broken structure.

And - I hardy dare to tell - some of the settings for valuelists disappeared. I tried to fix them by looking at the settings in version 3.5. When I came back to 4.1 they showed up again. Not always, but sometimes.

Same happens to users: Sometimes all users disappear when managing the server via browser interface. All of a sudden, they are back.

We definitely have a strange installation of Servoy 4.1! And for sure: we are the only ones with these problems :(

Regards
Birgit

Same happens to users: Sometimes all users disappear when managing the server via browser interface. All of a sudden, they are back.

Are you managing a stand-alone server or the one that starts by default with developer?

If you are managing the developer started server you should be aware that the users you see there are the ones kept in your active resource project. So for example if you have multiple resource projects in your workspace, and you change the active one (by changing the active solution) - you might end up with the effect you describe (because when you change the active resources project, you change the set of users/groups you are working with).

I guess it’s the ‘stand alone’. We start the servoy application server on our server at boot time with the command
. /Application/Servoy/application_server/servoy_server.sh &

We don’t think we did start the developer on the server. But if the problem occurrs again, we’ll check. Thank you.

If the application server is started and we would launch the developer on the server: what happens? Do two Servoy serves run? How can we check? On which port? How can they be managed? Or could I develop on the server as I can from the client via the existing application server?

I have to admit that we lack for a good overview.

Regards
Birgit

The users shouldn’t appear/dissapear with no reason on an app. server admin page… If you can reproduce this let us know how.

Yes, you can run the developer on the same comp as app. server. There are 3 things you must pay attention to when doing this:

    1. web server port on developer and app. server.
      Developer will (try to) start it’s own web server - so you can run web client from developer. If you do not change the port, starting web server will fail - you can change the web server port in “<install_dir>\application_server\server\conf\server.xml”.
    1. is developer going to start a database repository for “localhost” team provider or not (startAsTeamProvider = ? in servoy.properties).
      You should use startAsTeamProvider=false for developer as you already have the app. server running and you can access it as “127.0.0.1” with team.
      If you would have this set to true, developer will modify some things directly on the repository database, and some you would have to modify with “localhost” team provider - app. server would not be aware right away of the changes + it’s a bit confusing.
    1. which database connections are used by developer and app. server.
      If you are using same database connections in dev. and app. server make sure you know what you are doing as you might be modifying the same tables from 2 instances of Servoy.

As in a single installation, both developer and app. server use the same “server.xml” and “servoy.properties” files, you would be better off having 2 separate installations - 1 for app. server and 1 for developer. This way you can have different webserver ports and startAsTeamProvider values without changing them all the time.

Thanks for the detailed description.

  • Until now server/user problems did not show up again
  • unresolved image media settings show up now and then. I ignore them since I know, they’ll be gone soon.

Everything else works perfect: checkout, commit, update, synchronize, debug, quick fix, … It’s just fun!

Regards
Birgit