<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Efficy Overflow Q&amp;A - Recent questions tagged insert</title>
<link>https://overflow.efficy.io/?qa=tag/insert</link>
<description>Powered by Question2Answer</description>
<item>
<title>Insert a value in a lookup table during the datasynchro</title>
<link>https://overflow.efficy.io/?qa=3976/insert-a-value-in-a-lookup-table-during-the-datasynchro</link>
<description>&lt;p&gt;Hello Efficy Team, &lt;/p&gt;

&lt;p&gt;A customer have a big Excel file to import with a DataSynchro. My quesion is simple : how, with an Efficy method / function, could we insert a value in a Lookup if this value does not exist ? &lt;/p&gt;

&lt;p&gt;Last time I had to do that, I did it with an insert in SQL :( &lt;br&gt;
Not really clean.&lt;/p&gt;

&lt;p&gt;Is there a more &quot;efficient&quot; way to do that ? &lt;/p&gt;

&lt;p&gt;Thanks in advance, &lt;/p&gt;

&lt;p&gt;Loïc&lt;/p&gt;
</description>
<category>WorkFlow / Serverscript</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=3976/insert-a-value-in-a-lookup-table-during-the-datasynchro</guid>
<pubDate>Thu, 21 Feb 2019 16:04:53 +0000</pubDate>
</item>
<item>
<title>How to insert a project and link it to a company</title>
<link>https://overflow.efficy.io/?qa=3184/how-to-insert-a-project-and-link-it-to-a-company</link>
<description>&lt;p&gt;Hi everyone.&lt;/p&gt;

&lt;p&gt;Im working on a method with the C# proxy for add 377 projects with the same Name (Reporting)&lt;/p&gt;

&lt;p&gt;and link it to a company with the efficyKey.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;here is my code : 

 try
        {
            List&amp;lt;Company&amp;gt; Companies = GetAllCompanies();
            Companies = Companies.Where(a =&amp;gt; a.TypeRelation == CompRelationType.Participee || Convert.ToInt32(a.TypeRelation) == 9).Select(a =&amp;gt; a).ToList();

            TContextHandle EditContext;

            foreach (var Iterator in Companies)
            {
                EditContext = Proxy.OpenEditContext(&quot;PROJ&quot;, 0);

                Hashtable Fields = new Hashtable();
                Fields.Add(&quot;NAME&quot;, &quot;Reporting&quot;);

                Proxy.UpdateFields(EditContext, Fields);

                TContextHandle EditDocuProd = Proxy.OpenEditContextRelation(&quot;PROJ&quot;, EditContext.Key, &quot;COMP&quot;, Iterator.EfficyKey, -1);
                Proxy.CloseContext(EditDocuProd);
            }
        }
         catch(Exception E)
        {
            DisposeProxy();
            Helper.LogHelper.LogMessage(Helper.LogHelper.MessageType.Error, &quot;Error EfficyDataLayer.AddDossierForSoc()&quot;);
            Helper.LogHelper.LogExceptionMessage(E);
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I got an error after the CloseContext because the project is not link to any company.&lt;/p&gt;

&lt;p&gt;Do u have the right method to do that ?&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;

&lt;p&gt;Vessiere Thomas.&lt;/p&gt;
</description>
<category>Remote API (JSON, SOAP, Node)</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=3184/how-to-insert-a-project-and-link-it-to-a-company</guid>
<pubDate>Fri, 25 May 2018 13:31:18 +0000</pubDate>
</item>
<item>
<title>upload mail to efficy from script</title>
<link>https://overflow.efficy.io/?qa=1158/upload-mail-to-efficy-from-script</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;I'm using datasync to parse directory and upload all email in it to Efficy. I've tried to use the usual way of insertAttachment to newly created Mail &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ImportFiles.prototype.ImportFile = function(EditMail, FilePath, FileName) {
        Database.InsertAttachment(EditMail, 1, FilePath);
        var AttachmentText = StrLoadBinaryFile(FilePath); 
        var FileDS = Database.GetDetailDataSet(EditMail, ntFile);  
        FileDS.Edit;
        FileDS.FieldByName('STREAM').AsString = AttachmentText;
        Database.UpdateDetail(EditMail, ntFile, 0, 0, 'FILESIZE', AttachmentText.length); 
        Database.UpdateDetail(EditMail, ntFile, 0, 0, 'PATH', FilePath); 
        Database.UpdateDetail(EditMail, ntFile, 0, 0, 'COMMENT', FileName);
        Database.CommitChanges(EditMail, false);
        Database.CloseContext(EditMail);
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;but i'm getting error:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Error during CommitChanges on &quot;Mail&quot;: Could not convert variant of&lt;br&gt;
  type (Null) into type (Double)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Please advise.&lt;br&gt;
thank you.&lt;br&gt;
Best Regards.&lt;/p&gt;
</description>
<category>WorkFlow / Serverscript</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=1158/upload-mail-to-efficy-from-script</guid>
<pubDate>Fri, 08 Jan 2016 16:31:27 +0000</pubDate>
</item>
</channel>
</rss>