Display image on portal from rbf_selectQuery method - Forum - Rollbase - Progress Community

Display image on portal from rbf_selectQuery method


Display image on portal from rbf_selectQuery method

This question is not answered

Hi everyone,

I have an object named 'items' with fields 'name' (text type), 'description' (text type) and 'image' (image type). 

On my portal, I am getting all my items object by using:
        rbf_selectQuery("SELECT id, name, description, image FROM items");

I am able to get the id, name and decription as I expected. However, for the image I get something like this:
        image: "#Wed Jan 07 16:49:59 CST 2015↵fileSize=58940↵origFileName=Miss ERG 2013.jpg↵contentType=image/jpeg↵fileName=tmp_1355777917861767083.jpg↵"

Is there a way that I could display the image corresponding to what was uploaded on the server side?

Thank you very much!

All Replies
  • Hello,

    Are you trying to display a list of records from a native Rollbase portal, each record having a custom image?

    You can use {!image#url} or {!image#html} tokens.

  • {!image} will return the content ready to be displayed in an HTML page ( url is embedded in the <img> tag)

  • Hi ymaisonn,

    I actually want to display a list of records in a rollbase generic page portal where each record has a custom image and put the records in a custom table. Using rbf_selectQuery() method on the portal page enables me to get the expected data from the rollbase sever EXCEPT for the file image type.

    I tried replacing the 'image' part in the rbf_selectQuery and had this:

       rbf_selectQuery("SELECT id, name, description, {!image#url} FROM items", 200, callbackFunc);

    but the server returns a query syntax error. The "{!image#url}" argument caused the error.

    Could you help me a little more by elaborating what you meant by using '{!image#url}' to display the images in the portal?


  • Hello,

    The situation is different using a generic portal page

    The rbf_selectQuery() API returns the image properties in the image field.

    You can try to parse these properties and create URL with format

    Another approach is to do the following:

    1. Create a List View which filters records the way you want.
    2. Create a LOOP template using that view
    3. Use #url template token on records in the loop to return the Image URL of use the #html token to return the html image tag (image will display on screen).If you don't specify a token template the HTML image tag will return by default ({!image} is equivalent to {!image#html}

    Note that this report runs a loop through all records using a view with the original ID 10000. Inside the loop, each record outputs a row of an HTML table.

    <h2>List of Items </h2>
    <table style='width: 500px;' border='1' cellspacing='1' cellpadding='1'>

    Replace "all" by the relationship ID (Rxxxxx) if you want to filter the results related to a dependent object.

    You can return the first 10 records by replacing {!#LOOP_BEGIN.all#10000} by {!#LOOP_BEGIN.all#10000(10)}

    Please let me know if the proposed solutions are acceptable to you