lunedì 16 novembre 2015

AX 2012 - Fare il merge di 2 ledger dimension

In questo post vediamo come effettuare il merge di 2 dimensioni finanziarie. Nel mio dovevo creare una nuova ledger dimension facendo il merge tra una dimensione che mi sono calcolato ( http://somarisuax.blogspot.it/2014/12/ax-2012-creare-una-ledgerdimension.html)



 e la dimensione di default nella mainAccountLegalEntity che nel mio caso aveva la dimensione "Commessa" fissa:


Basterà chiamare il metodo

 combinedLedgerDimension = DimensionDefaultingService::ServiceCreateLedgerDimension(ledgerDimension, mainAccountLegalEntity.DefaultDimension);  

combinedLedgerDimension contiene la dimensione combinata:



martedì 10 novembre 2015

AX 2012 - Query sql per estrarre il codice sorgente dal model

Ciao! con questa query sql potete estrarre il codice degli dal database model di Ax


 use "Model_db"  
 IF (OBJECT_ID('tempdb..#SOURCES') IS NULL)  
 begin  
         --drop table #SOURCES  
         SELECT  
                  b.Name  
                  ,b.ElementHandle  
                  ,coalesce(e.ElementTypeName, el.ElementTypeName) [Type]  
                  ,coalesce(pr.Name, b.Name) [Internal Name]  
                  ,parent.Name [Parent Name]  
                  ,d.Name [Layer]  
                  ,a.[LayerId]  
                  ,c.DisplayName [Model Display Name]  
                  ,c.Name [Model Name]  
                  ,a.[ModelId]  
                  ,a.[MODIFIEDDATETIME]  
                  ,a.[MODIFIEDBY]  
                  ,a.[CREATEDDATETIME]  
                  ,a.[CREATEDBY]  
                  ,cast(coalesce(sr.SourceText, sr1.SourceText) as nvarchar(max)) [Source]  
                 INTO #SOURCES   
         --select count(*)  
          FROM [ModelElementData] a   
                                 inner join [ModelElement] b  
                                        on     a.ElementHandle = b.ElementHandle  
                                 inner join [ModelManifest] c  
                                        on a.ModelId = c.ModelId  
                                 inner join [Layer] d  
                                        on a.LayerId = d.Id  
                                 left join [ModelElement] parent  
                                        on b.ParentHandle = parent.ElementHandle  
                                 left join [ModelElement] pr  
                                        on b.ElementHandle = pr.ParentHandle  
                                 left join [ElementTypes] e  
                                        on pr.ElementType = e.ElementType  
                                 left join [Sources] sr  
                                        on sr.SourceHandle = pr.ElementHandle   
                                 left join [ElementTypes] el  
                                        on b.ElementType = el.ElementType  
                                 left join [Sources] sr1  
                                        on sr1.SourceHandle = b.ElementHandle   
          where not b.Name is null  
                 --and  b.Name like '%InterfaceMacroservice%'   
                 --and coalesce(e.ElementTypeName, el.ElementTypeName) like '%Method%'  
                 --and cast(coalesce(sr.SourceText, sr1.SourceText) as nvarchar(max)) like '%InterfaceMacroService%'  
           --order by 1  
         SELECT TBL.name AS ObjName   
                  ,STAT.row_count AS StatRowCount   
                  ,STAT.used_page_count * 8 AS UsedSizeKB   
                  ,STAT.reserved_page_count * 8 AS RevervedSizeKB   
         FROM tempdb.sys.partitions AS PART   
                 INNER JOIN tempdb.sys.dm_db_partition_stats AS STAT   
                         ON PART.partition_id = STAT.partition_id   
                                 AND PART.partition_number = STAT.partition_number   
                 INNER JOIN tempdb.sys.tables AS TBL   
                         ON STAT.object_id = TBL.object_id   
                         --where TBL.name = '#SOURCES'  
         ORDER BY TBL.name;  
         CREATE INDEX IDX_NAME ON #SOURCES(Name)  
 end  
 --------------------------------------------------------------------  
 select top 10 *  
 from #SOURCES  
 where Name ='SalesFormLetter'  

Nella clausola Where dell'ultima riga potete fare i filtri sul nome dell'oggetto.

L'output è fatto così:


giovedì 5 novembre 2015

SSRS - Aggiungere TextBox HTML in un report

In questo post vediamo come aggiungere un controllo HTML ad un report SSRS:

Apriamo il design del report da Visual studio ed inseriamo una text box normale.

A questo punto selezioniamo il contenuto della cella così:


Ora nel form che si apre selezioniamo:


A questo punto possiamo inserire codice html nell'espressione della textbox:


Ci sono un numero limitato di tag che SSRS riesce ad interpretate. Trovate quì i dettagli:

https://msdn.microsoft.com/en-us/library/ff519562.aspx