Printing image from internet on RTC report

zeonzeon Member Posts: 130
edited 2013-10-04 in NAV Three Tier
Hi,

Is it possible to use/print an image (jpeg) from the internet directly on a RTC report?

TIA

Answers

  • Wisa123Wisa123 Member Posts: 308
    Hi,

    I know it can be achieved to insert Pictures on your local drive using Picture Control.
    To be honest i wouldn't do this anyway, you dont know how long the Picture is gonna stay on the site or the URL.

    Better Copy it and Import it into a BLOB Field in the Database.
    Austrian NAV/BC Dev
  • zeonzeon Member Posts: 130
    The reason for linking directly to the url is that the image is already used for the customers web shop, and therefore the image will not be deleted. I just wanted to use the same resource as the web shop in stead of importing the picture to the db.
  • amazanamazan Member Posts: 17
    Hi Zeon,

    Try this code (nav 2013), it looks like what you want.
    OBJECT Report 80000 Internet Logo - Simple Test
    {
      OBJECT-PROPERTIES
      {
        Date=04/10/13;
        Time=[ 9:38:16];
        Modified=Yes;
        Version List=amazan;
      }
      PROPERTIES
      {
        EnableExternalImages=Yes;
      }
      DATASET
      {
        { 1000000000;;DataItem;                  ;
                   DataItemTable=Table2000000026;
                   DataItemTableView=SORTING(Number)
                                     ORDER(Ascending)
                                     WHERE(Number=FILTER(1..2));
                   OnAfterGetRecord=BEGIN
                                      CASE Number OF
                                        1: InternetImage := 'http://www.microsoft.com/spain/prensa/resources/ContentImages/Contents/2012/10/fotoCentro_dynamics-nav.jpg';
                                        2: InternetImage := 'http://i.microsoft.com/global/en-us/dynamics/PublishingImages/AA_A_Shell/logo-microsoft-dynamicsV3.png';
                                      END;
                                    END;
                                     }
    
        { 1000000001;1;Column;Internet_Image     ;
                   SourceExpr=InternetImage }
    
      }
      REQUESTPAGE
      {
        PROPERTIES
        {
        }
        CONTROLS
        {
        }
      }
      LABELS
      {
      }
      CODE
      {
        VAR
          InternetImage@1000000000 : Text;
    
        BEGIN
        {
          amazan - 04-10-13 - Internet Logo Simple Test
        }
        END.
      }
      RDLDATA
      {
        <?xml version="1.0" encoding="utf-8"?>
    <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition">
      <DataSources>
        <DataSource Name="DataSource">
          <ConnectionProperties>
            <DataProvider>SQL</DataProvider>
            <ConnectString />
          </ConnectionProperties>
          <rd:DataSourceID>42f3b91c-3aa1-4335-9d4d-60bd73690f8e</rd:DataSourceID>
        </DataSource>
      </DataSources>
      <DataSets>
        <DataSet Name="DataSet_Result">
          <Fields>
            <Field Name="Internet_Image">
              <DataField>Internet_Image</DataField>
            </Field>
          </Fields>
          <Query>
            <DataSourceName>DataSource</DataSourceName>
            <CommandText />
          </Query>
          <rd:DataSetInfo>
            <rd:DataSetName>DataSet</rd:DataSetName>
            <rd:SchemaPath>Report.xsd</rd:SchemaPath>
            <rd:TableName>Result</rd:TableName>
          </rd:DataSetInfo>
        </DataSet>
      </DataSets>
      <Body>
        <ReportItems>
          <Tablix Name="Tablix1">
            <TablixBody>
              <TablixColumns>
                <TablixColumn>
                  <Width>3in</Width>
                </TablixColumn>
              </TablixColumns>
              <TablixRows>
                <TablixRow>
                  <Height>1.42in</Height>
                  <TablixCells>
                    <TablixCell>
                      <CellContents>
                        <Image Name="Image1">
                          <Source>External</Source>
                          <Value>=Fields!Internet_Image.Value</Value>
                          <Sizing>FitProportional</Sizing>
                          <Style>
                            <Border>
                              <Style>None</Style>
                            </Border>
                          </Style>
                        </Image>
                      </CellContents>
                    </TablixCell>
                  </TablixCells>
                </TablixRow>
              </TablixRows>
            </TablixBody>
            <TablixColumnHierarchy>
              <TablixMembers>
                <TablixMember />
              </TablixMembers>
            </TablixColumnHierarchy>
            <TablixRowHierarchy>
              <TablixMembers>
                <TablixMember>
                  <Group Name="Internet_Image">
                    <GroupExpressions>
                      <GroupExpression>=Fields!Internet_Image.Value</GroupExpression>
                    </GroupExpressions>
                  </Group>
                  <SortExpressions>
                    <SortExpression>
                      <Value>=Fields!Internet_Image.Value</Value>
                    </SortExpression>
                  </SortExpressions>
                  <TablixHeader>
                    <Size>3in</Size>
                    <CellContents>
                      <Textbox Name="Internet_Image">
                        <CanGrow>true</CanGrow>
                        <KeepTogether>true</KeepTogether>
                        <Paragraphs>
                          <Paragraph>
                            <TextRuns>
                              <TextRun>
                                <Value>=Fields!Internet_Image.Value</Value>
                                <Style />
                              </TextRun>
                            </TextRuns>
                            <Style />
                          </Paragraph>
                        </Paragraphs>
                        <rd:DefaultName>Internet_Image</rd:DefaultName>
                        <Style>
                          <Border>
                            <Color>LightGrey</Color>
                            <Style>Solid</Style>
                          </Border>
                          <PaddingLeft>2pt</PaddingLeft>
                          <PaddingRight>2pt</PaddingRight>
                          <PaddingTop>2pt</PaddingTop>
                          <PaddingBottom>2pt</PaddingBottom>
                        </Style>
                      </Textbox>
                    </CellContents>
                  </TablixHeader>
                </TablixMember>
              </TablixMembers>
            </TablixRowHierarchy>
            <DataSetName>DataSet_Result</DataSetName>
            <Top>0.205in</Top>
            <Left>0.21542in</Left>
            <Height>1.42in</Height>
            <Width>6in</Width>
            <Style>
              <Border>
                <Style>None</Style>
              </Border>
            </Style>
          </Tablix>
        </ReportItems>
        <Height>4.20833in</Height>
        <Style />
      </Body>
      <Code>Public Function BlankZero(ByVal Value As Decimal)
        if Value = 0 then
            Return ""
        end if
        Return Value
    End Function
    
    Public Function BlankPos(ByVal Value As Decimal)
        if Value > 0 then
            Return ""
        end if
        Return Value
    End Function
    
    Public Function BlankZeroAndPos(ByVal Value As Decimal)
        if Value >= 0 then
            Return ""
        end if
        Return Value
    End Function
    
    Public Function BlankNeg(ByVal Value As Decimal)
        if Value < 0 then
            Return ""
        end if
        Return Value
    End Function
    
    Public Function BlankNegAndZero(ByVal Value As Decimal)
        if Value <= 0 then
            Return ""
        end if
        Return Value
    End Function
    </Code>
      <Width>6.5in</Width>
      <Page>
        <Style />
      </Page>
      <Language>=User!Language</Language>
      <ConsumeContainerWhitespace>true</ConsumeContainerWhitespace>
      <rd:ReportID>0eeb6585-38ae-40f1-885b-8d50088d51b4</rd:ReportID>
      <rd:ReportUnitType>Inch</rd:ReportUnitType>
    </Report>
        END_OF_RDLDATA
      }
    }
    

    :thumbsup:
  • zeonzeon Member Posts: 130
    Thx, easier than expected.
Sign In or Register to comment.