I have fields such as qualifications, publications, conferences, consultancies for each person in a database. Not all fields will have data.
I want to display the data for an individual on a dynamic page but with no gaps where the data is missing. If the qualifications field has no data, I don’t want to display a heading such as “Qualifications” without any information under it - I want to display the next non-blank field - publications, conferences or consultancies.
So my first approach is to not have set text headings on the dynamic page but rather to include the heading “Publications” as the first line in the Publications field (Rich Text format). So if there are no publications for this individual there is no data in this field (not even the “Publications” heading). I could instead possibly do this in a bit of code - i.e display “Publications” in heading format before displaying the data from the publications field (no heading if blank field).
Can I use code to only display the headings & data for the fields that are non-blank i.e Qualifications heading & data is displayed (but only if this field is non-blank) otherwise/then Publications heading & data is displayed (but only if this field is non-blank) otherwise/then Conferences heading & data are displayed (but only if this field is non-blank), etc.
Hopefully this would avoid gaps in the display of database fields some of which are blank?
So I’m looking for the correct approach to achieve this
Do I query the Qualifications field in the database & if it’s non-blank then connect it to the first text box defined on the dynamic page - text25 otherwise, If it is blank then query the next database field, Publications & if non-blank connect to text25 box etc?
So basically, text25 (first text display object on dynamic page) is connected to first non-blank database field; text26 is connected to next non-blank database field, etc.
OK, I tried every version of the code examples but can’t get it to work. My guess is I’m not testing the database text field correctly to see if it’s blank. These are all Rich Text fields some of which have no entries
What should I test to check if this Rich Text field has nothing in it?
Are any of these code snippets correct for this test? if (!$w(“#teamDataset”).getCurrentItem().Qualifications){
$w(“#text25”).collapse();
// Checks if the current item has a value in the “Qualifications” field if (!item.Qualifications) {
// Collapses the #text25 field if there is no text in “Qualifications”
$w(“#text25”).collapse();
}
Neither are working
I tested out the collapse commands & they produce some unwanted outcomes in the formatting of the webpage - vertical spacing between sections which cannot be avoided & fixed. Here are screen shots showing what I mean:
First the dynamic page screen shot from the editor
The approach in my original question would avoid these vertical spacing issues. My question was - could a database field be dynamically assigned to a webpage text box on the fly rather than defined once on the webpage?
In other words I have 4 text boxes on the page & the contents of the first non-blank database text field is moved to the first text box on the page, the contents of the next non-blank database text field into the next box, etc.
If it’s not possible to assign database fields dynamically to text boxes, can a database record be read into a temporary data structure & this structure examined with the above logic applied?
Another thought - if the collapse of a text box removed the box & the vertical spacing between boxes, it might work out OK?
Sorry if this is basic stuff but I’m not a Java programmer
A possible (but long-winded) way to achieve this is by not having any vertical spacing between the page text boxes but rather to include a blank first line in any database field that will have text.
If I also put the heading in the database rich text field then I can nearly achieve what I want but it’s really a manual, long-winded effort which has to be applied to each non-blank database text field - I have to put blank line + Section heading in each database field that will have text
Is there no automated way to do this?
Here are the screen shots of the same two database rows as above - First Person & Second Person using this method of organising the text in the database fields & making each field on the dynamic page one under the other with n blank lines between them
As can be seen there is still some vertical space being added between the dynamic text boxes displayed on screen - noticeable in the display of Second Person where there’s no text in the fields Qualifications, Publications, Conferences - there’s only text in the last field, Consultancies. The collapse of the 3 fields above Consultancies leaves some vertical space
First Person - with all text fields containing blank line + heading + text in each relevant database field - it looks fine but each database field has to be structured as mentioned - just too manual & time consuming.
Second Person - with only last database text field containing - blank line + heading + text. The display of this Conference text is displayed & the collapse of the null fields before that still shows some vertical space being inserted. If collapse was working correctly & it completely removed the text box, that last field, Conference, should only be one blank line below the text above!
I know. I tried to use the forum to get some help in the last three years and not one I got a response. I feel you. I think the easiest way is use the database. Don’t use the headings on the site. Use the heading (rich text) in the database. Good Luck!
Thanks for answering. You mean use the Database/Collection column headings as the displayed heading along with the field contents instead of a fixed text heading on the screen ? So if no data in the database field, no heading is displayed instead of blanking out a text frame? I wasn’t aware I could display the database field column heading just as I use the data in the field as a variable display? Is this documented anywhere?
Thanks I misunderstood - I thought you were using your collection column heading text as the text to appear as the heading on screen but I see that’s not the case. So how are you using part of the field contents as the heading text & the rest of the field contents as the text under the heading? My columns are
OK, I think I understand now - the whole text in the field contains the heading & the content with the formatting as required i.e blank lines between heading & text - Like this:
I did think of something along these lines before. Is there any way I can control the size of the text “PUBLICATIONS” - I can only make the whole field larger text , not a part of it?
Thanks, yes, themes - I’ll have a read about them to see if it achieves what I want. Ah, I see I can customise the formatting of a Theme
At the moment I have another problem I might try starting a thread on - the images being filled by my live data in my repeater is in grey scale (used to be in colour) but when it is displayed in a non repeater field it is in colour. It is a website that is being worked on by a group of people so I can’t tie down where this happened - see live site here
When click on details, it goes to that students single page & image in colour
Edit: Actually, I found the problem - somebody had turned on a filter on the image