How to show additional column for Dynamic list

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

I have two fields: StartDate and EndDate and I want a Period presentation for them. I know I could create additional attribute and store presentation data there, but I really want to compose presentation during list showing. How could I do this? I know that for DataComposition Scheme I could define function for the field inside the query. Could I do the same or something like this for ListForm?

 
#2
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

You can use a custom query in the DynamicList (mark the CustomQuery property for that) and provide a custom field using query language, for example:

Code
SELECT
   CatalogContracts.Ref,
   CatalogContracts.StartDate,
   CatalogContracts.EndDate,
   DATEDIFF(CatalogContracts.StartDate, CatalogContracts.EndDate, MONTH) AS Period
FROM
   Catalog.Contracts AS CatalogContracts

 
#3
People who like this:0Yes/0No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

Why none of this works?

Code
YEAR(Document.Date) + " year"

CAST(YEAR(Document.Date) AS Number(4,0)) + " year"

CAST(CAST(YEAR(Document.Date) AS Number(4,0)) AS String)


How I could add some text to date, month or year presentation?

Edited: Alexey Gerasimov - Nov 01, 2012 04:49 AM
 
#4
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

It is not possible to cast a number to a string in query.

Please explain your task more directly. Provide a template of what you would like to implement.

I suggest you the following technique:

  • Add a column group with your start date and end date fields
  • Set Group property of the column group to In cell
  • Mark Show in header check box for the group
  • Set Title for the group as Period
  • Formatted your fields as you like using Format property of those fields
  • Unmark Show in header check boxes for start date and end date fields
  • You can add a separator using another field in the Query with " - " between them

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.