Manage Results from SQL Searches

in my case I’d already be happy to dynamically set dataproviders in a table view. My (FileMaker) customers have always requested to make their own lists. All they basically want is to choose the fields that show up on a list. This could be so eays since you can move and resize columns and sort on any of them. For that reason I have requested earlier to hide a column. Then I’d just make a table view with all relevant fields and just hide the un-needed. Much nicer, of course, is if a user was able to simply choose the relevant fields himself. Of course developers would need control over this, since a user might for example want to save a list layout. So for me, now, it’d be enough to have something like form.elements.addDataProvider…

bcusick:
Paul,

What you want to end up with is a string that looks like this:

Underline Link

If you are passing a parameter to your method - then you want to end up with:

Underline Link

The SINGLE QUOTES with the parameter are MANDATORY.

I managed to get a formatted HTML table with a href to a method (a very powerful feature), but I don’t understand HOW the destination method can actually receive the parameter: for instance, if my query gives me a list of items_id’s, and I have a method that opens the form ItemDetails, how can I tell this method to retrieve the item whose id I’m clicking on?

Riccardino,

did you try the example I posted in this tread?

var pkdataset = security.getUsers()
var HTML = ‘

’ //var HTML receives all html code
for( var i = 1 ; i <= pkdataset.getMaxRowIndex() ; i++ )
{
pkdataset.rowIndex = i;
HTML += ‘’;
}
HTML += ‘
’+ pkdataset[1]+‘<a href="javascript:test2(’+“'”+pkdataset[2]+“'”+‘)">’+ pkdataset[2]+‘

globals.userlist = HTML;

It’s a lot of quotes and double quotes, but if you are carefull and copy it properly, this code does work

Paul

pbakker:
Riccardino,

did you try the example I posted in this tread?

var pkdataset = security.getUsers()
var HTML = ‘

’ //var HTML receives all html code
for( var i = 1 ; i <= pkdataset.getMaxRowIndex() ; i++ )
{
pkdataset.rowIndex = i;
HTML += ‘’;
}
HTML += ‘
’+ pkdataset[1]+‘<a href="javascript:test2(’+“'”+pkdataset[2]+“'”+‘)">’+ pkdataset[2]+‘

globals.userlist = HTML;

It’s a lot of quotes and double quotes, but if you are carefull and copy it properly, this code does work

Paul

I’m not having problem with this code, but with - to use your example - the method test2… It launches, but it tells me that it could not evaluate the string ‘Test2(‘90’)’ (where 90 is the id of the record I click on).

Which instruction should I use in the destination method to get the parameter present into the html table? I thought that storing the parameter value in a variable would be the right approach, but I’m missing something…

var x = arg[0] in your method should retrieve the variable you passed into the method…

But the “Could not evaluate…” message I often got as well and solved that by putting the right quotes and double quotes in the HTML…

Paul

pbakker:
var x = arg[0] in your method should retrieve the variable you passed into the method…

But the “Could not evaluate…” message I often got as well and solved that by putting the right quotes and double quotes in the HTML…

Paul

Thank you, Paul

I tried your script: no problem with it, but I always get the same message warning me that arg [0] (or pkdataset[2]) is not defined when clicking on the link.

Ricardino,

Sounds strange. Beneath the code as I have it in my solution.

Create a local method called test2. This is the method that is called from within the HTML. Put the following code in the test2 method:

plugins.dialogs.showInfoDialog(‘Title’,arguments[0]+‘: Value not allowed’,‘OK’);

Now, also create a local main method with the following code:

var dataset = “FILL VAR DATASET WITH YOUR DATASET”
var HTML = ‘table {border: 5px solid “#3366ff”} td {border: 5px solid “#ff0000”} a {text-decoration : none; float: right; width: 200px; color:“#000000”}


var Input = dataset
var ColumnCount = Input.getMaxColumnIndex()
for( var i = 1 ; i <= ColumnCount ; i++ )
{
var ColumnHeader = Input.getColumnName(i)
HTML += ‘’
}
HTML += ‘’
//Get Record info
for( var i2 = 1 ; i2 <= Input.getMaxRowIndex() ; i2++ )
{
Input.rowIndex = i2;
HTML += ‘’;
for( var i = 1 ; i <= ColumnCount ; i++ )
{
var ColumnDetail = Input

  • HTML += ‘
’*
  • }*
  • HTML += ‘
  • ’ *
    }
    HTML += ‘
    ’+ColumnHeader+‘
    <a href="javascript:test2(’+“'”+ColumnDetail+“'”+‘)">’+ ColumnDetail+‘

    globals.Custom = HTML;
    Now, on your form you need a field of type = HTML area, non editable, called Custom. And you have to trigger the main method to generate the HTMl code and put it into the global.Custom field.
    Secondly, you need to define the dataset with whatever dataset you want.
    When you have done all of this, when clicking on one of the values in the HTML field, a dialog should appear, containing the value you just clicked… It works fine here…
    Paul

    Johan, in addition to the features needed for the element/vuew where columns can be added/removed dynamically: To be able to store the user settings, I think we need to be able to retrieve the culumns shown, in which order and the width of each column.

    Can an up/down arrow be added to the header of the column that has had the last sort action?

    Paul

    pbakker:
    Ricardino,

    Sounds strange. Beneath the code as I have it in my solution.

    Gotcha! :lol:

    The problem was that I put the method into the script using the “Move Code” command so, instead of:

    		HTML += '<td><a href="javascript:test2('+"'"+ColumnDetail+"'"+')">'+ ColumnDetail+'</a></td>'
    

    I was having:

    		HTML += '<td><a href="javascript:test2();('+"'"+ColumnDetail+"'"+')">'+ ColumnDetail+'</a></td>'
    

    Thanks a lot, Paul :D [/code]

    :) NP