<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Efficy Overflow Q&amp;A - Recent questions tagged runquery</title>
<link>https://overflow.efficy.io/?qa=tag/runquery</link>
<description>Powered by Question2Answer</description>
<item>
<title>Use query for result value in virtual field</title>
<link>https://overflow.efficy.io/?qa=4873/use-query-for-result-value-in-virtual-field</link>
<description>&lt;p&gt;I've got a virtual field in a category. See screenshot. &lt;img src=&quot;https://overflow.efficy.com/?qa=blob&amp;amp;qa_blobid=17095528798307630503&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;
I used the &quot;1&quot; hardcoded as value, but I would like to use the query I defined. See code (in MacroLibraryCustom) below.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;VMKostenraming {[
&amp;lt;%RunQuery(id=&quot;VMKostenraming&quot;
,sql=&quot;select sum(price*quantity) as VMKostenraming from &amp;lt;#TABLE NAME=DOCU_PROD&amp;gt; where k_document = :param1&quot;
,store=&quot;36&quot;
,param1='%%GetKey()'
)%&amp;gt;
&amp;lt;input type=&quot;TEXT&quot; readonly &amp;lt;%GetField('$FIELDNAME$', category='$CATEGORY$', context=TEXT)%&amp;gt; id='$FIELDNAME$' value=&quot;1&quot;)%&amp;gt;
]}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So now I want to replace the 1 in the virtual field with the result from the query. But when trying to use GETFIELD I get an error that the field is not defined. How to do this with virtual fields?&lt;/p&gt;

&lt;p&gt;Thanks for your help!&lt;/p&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=4873/use-query-for-result-value-in-virtual-field</guid>
<pubDate>Mon, 07 Oct 2019 11:46:51 +0000</pubDate>
</item>
<item>
<title>Use RunQuery in Grid</title>
<link>https://overflow.efficy.io/?qa=3699/use-runquery-in-grid</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I use Efficy 10.2 :&lt;br&gt;
I need to add some columns in the ProjConsult.ProductsGrid&lt;br&gt;
I can calculate each column value for each product in the grid with the sql query Below . I need to add a column for 'PLAN' an other for 'REAL' and an other for 'BENEFIT'&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;select Sum(ProdProd.F_PLAN) as [PLAN], Sum(ProdProd.F_REAL + ProdProd.F_REST) as [REAL]
      ,(Sum(ProdProd.F_PLAN) - Sum(ProdProd.F_REAL + ProdProd.F_REST)) as [BENEFIT]
    from PROD_PROJ ProdProj
    join PROD_PROD ProdProd on ProdProd.K_PRODUCT=ProdProj.F_LOT and ProdProd.K_PRODUCT2=ProdProj.K_PRODUCT
    where ProdProj.K_PROJECT=203 and ProdProj.K_PRODUCT=84
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As you can see, this query need the K&lt;em&gt;PROJECT (Master entity) and the K&lt;/em&gt;PRODUCT of the current row.&lt;/p&gt;

&lt;p&gt;How can I define a RunQuery with this kind of query ?&lt;br&gt;
Or is there a way to create a virtual field (add V&lt;em&gt;... in SYS&lt;/em&gt;FIELDS) and assign it a stored procedure with 2 parameters ?&lt;/p&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=3699/use-runquery-in-grid</guid>
<pubDate>Wed, 05 Dec 2018 15:01:58 +0000</pubDate>
</item>
</channel>
</rss>