How to display fields and tables on the same screen?

Please login to reply  Page: « < 1 of 1 > »
29 Jun 2010 - 20:14663
How to display fields and tables on the same screen?

Hi,

I’ve been trying to display two regular fields and a Table (array of blocks) on the same screen without success up to this moment. I don’t know what I am doing wrong, but even though I’m not writing the command “NEWPAGE” on Rules section Blaise keeps displaying the Table on a new page. Why?

The code follows:

Datamodel test
    Include "Tbl_Servicos.inc"

    Fields
        receita_liquida "Receita líquida (receita informada no código 028 do questionário principal)"/
                        "Receita líquida (receita informada no código 028 do questionário principal)": 0..9999
        subvencoes "Subvenções (informados no código 030 do questionário principal)"/
                   "Subvenções (informados no código 030 do questionário principal)": 0..9999
        tbl_svc : Tbl_Servicos

    Rules
        receita_liquida
        subvencoes
        tbl_svc
EndBlock


29 Jun 2010 - 21:00665

You're talking about the Data Entry Program (DEP), right? And not Blaise Internet?

If you look at the dep, that lower grey part (called the formpane) really has an invisible grid on it. The default is 8 rows by 2 columns for normal questions, and 8 rows and 'unlimited' columns for tables.

When you start the modelib editor from the tools menu, you'll also see this at the 2 default grids defined at Layout | Interviewing | Grids

When you change grids somewhere inbetween the questionnaire, whether you do it explicitly with an 'AFTER FieldName GRID MyCustomGrid' in the layout section, or implicitly by switching to a table and back, those questions on the new grid always appear on a new page. That's because the system simply can't combine grids at the same page.

If you're talking about Blaise Internet, you can avoid this by a little trick. Just create the table1 in your datamodel, and in the Interview Specification a 'Matrix Group' will be automatically be generated for you. Now change the TABLE1 and ENDTABLE back to BLOCK and ENDBLOCK in your datamodel, so that those questions will use the defaultgrid again. The 'Matrix Group'-definition will still show it as a table in the browser, but now you can combine non-table questions with it on the same page.

PS where I write Table1, forget the 1. If I don't add the one, the system won't post the reply.




Last edited by Ralph Dolmans (29 Jun 2010 - 21:03)
30 Jun 2010 - 13:45669

Thanks Ralph. I forgot to say that I was talking about DEP, sorry for that.

Let me see if I got it right: DEP is unable to display 2 different layouts (grids) on the same screen, is that so?
So, if I have a form with a complex layout I will need to collect information on several different pages, won't I?
Is there no way to workaround this?



30 Jun 2010 - 14:35671
Quote arthurbeltrao:
Let me see if I got it right: DEP is unable to display 2 different layouts (grids) on the same screen, is that so?

Yes, that's correct.

Quote:
So, if I have a form with a complex layout I will need to collect information on several different pages, won't I?
Is there no way to workaround this?

You can refer to multiple blocks in one table, like this:

Table HouseholdTable
  Locals i: INTEGER
  FIELDS
    Household: ARRAY[1..3] of BHousehold
    Work: ARRAY[1..2] of BWork
  RULES
    FOR i := 1 TO 3 DO
      Household[i]
    ENDDO
    Work[1]
    Work[2]
ENDTABLE

So here the first 3 rows of the table will have the questions of block BHousehold, and the last two lines the questions of block BWork. And those questions can be totally different.

So now all this shows on the same page, because it's defined at the same table. The drawback of this is the column headers you have at the top, they only make sense for the questions of the household block. If you don't need the column headers, you can switch them off in the Grid definition of the _DefaultTableLayout in the mode library, and then this can be a suitable workaround.



30 Jun 2010 - 18:46674

Ralph,

Thanks! I will try this combination of Blocks and Layout sections using the Mode Lib Editor.



Please login to reply  Page: « < 1 of 1 > »