Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

I do not see the sheet created at runtime

Sorry but I just can not understand do'm wrong ... I'm trying to create a sheet at runtime from a C # program, but if I move in the browser do not see anything.

Here in my code

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using Qlik.Engine;

using Qlik.Sense.Client;

using Qlik.Sense.Client.Visualizations;

namespace WindowsFormsApplication1

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

        private void Form1_Load(object sender, EventArgs e)

           

        {

            ILocation location;

            //= Qlik.Engine.Location.Local;

           

            location = Qlik.Engine.Location.Local;

            location.AsDirectConnectionToPersonalEdition();

            using (IHub hub = location.Hub())

            {

                label1.Text = hub.QvVersion();

            }

        }

        private void btnSheet_Click(object sender, EventArgs e)

        {

            ILocation LocalQliksense = Qlik.Engine.Location.Local;

            IAppIdentifier foundAppIdentifier = LocalQliksense.AppWithName("xx2");

            IApp application = LocalQliksense.App(foundAppIdentifier);

           

            ISheet mySheet = application.CreateSheet("mySheet");

            if (mySheet != null)

            {

                mySheet.SuspendLayout();

                mySheet.Properties.MetaDef.Title = "Title Sheet";

                mySheet.Properties.Rank = 3;

                mySheet.ResumeLayout();

               

            }

            application.DoSave(); 

        }

}

Thanks corchi

4 Replies
Not applicable
Author

Hi,

You have actually created a sheer, you can verify that there is a sheet by :

var title = applcation.GetSheets().First().SheetMetaData.Title;

Do you have a script? The client does not show the sheets until you have a script.

If you add the following rows to your code you will see the sheet in the client.

pplication.SetScript("Load RecNo() as Dim1 AutoGenerate 100;");

application.DoReload();

Best regards

Lars-Göran Book

Anonymous
Not applicable
Author

It tests successes I've performed after loading data from an Excel spreadsheet, but I think that the error in this case you have to bring to an event that I've logged in comunity

Terrible !!! All sheets are deleted

In fact, if you run before the code:

ISheet mySheet = application.CreateSheet("mySheet");

      

   if (mySheet != null)

            {

                try

                {

                  

                    mySheet.Properties.MetaDef.Title = "Sheet2";

                    mySheet.Properties.Rank = 2;

               

                  

                }

unfortunately are deleted all sheet of QVF and damaged the file ...so the all subsequent tests areare useless

So I recreated a new file ,and I added the following lines to the previous ,and this works

mySheet.SuspendLayout(); //with this work

                mySheet.Properties.MetaDef.Title = "Title Sheet";

                mySheet.Properties.Rank = 3;

                mySheet.ResumeLayout(); //with this work

Unfortunately, the error is due to the fact that in the examples of qliview which explains how to create a sheet is not indicated these warnings

see these examples

http://help.qlik.com/sense/en-US/developer/#../Subsystems/NetSdk/Content/HowTos/NetSdk_WorkWith_Gene...

thank corchi

Not applicable
Author

Hi again,

We will improve the examples so that are more complete and that they work with the client.

Regarding setting properties have a look at :

http://help.qlik.com/sense/en-US/developer/#../Subsystems/NetSdk/Content/HowTos/NetSdk_WorkWith_Gene...

// Lars-Göran Book

Anonymous
Not applicable
Author

ok ....thanks so much for your patience and clarifications

Corchi