EP Samples from TechReady3
Yesterday (07/24/2006) I presented at TechReady3 (Microsoft‘s Internal Technical Readiness Event) on the EP Session. I demoed creating a web page to display vendor list with “zero code”. And then I demoed how you could do the same thing completely through coding to control the layout and format. Then I demoed the WebPart Connection and how you can control what is being displayed on the left menu based on some business logic and here is the code sample that I used.
Here is the sample code of the weblet that I created in this demo
public class TechReadyWebLet extends WebLet
{
boolean _even;
}
public void run(Args args)
{
str ret;
VendTable vt;
ret = "<h1>Top 10 Vendors</h1>";
ret += "<table border=0>";
_even=1;
while select vt
where vt.AccountNum < '3010'
{
if ( _even ==1)
ret += "<tr>";
ret += "<td><div class=formcaption>";
if ( vt.VendGroup == '10')
ret += "<IMG src=/_layouts/ep/images/green.gif /> ";
if ( vt.VendGroup == '50')
ret += "<IMG src=/_layouts/ep/images/yellow.gif /> ";
ret+= vt.name + "</div>";
ret += vt.address + "<br>" + vt.state +" " + vt.zipcode + "<br>" + vt.countryregionid + "</td>";
if ( _even ==0)
ret += "</tr>";
_even = _even ? 0 : 1;
}
ret += "</table>";
webSession().writeTxt(ret);
}
Here is the sample code that I used in EPVendTableInfo Web form to demo the Web Part connection
public boolean showMenuFunction(WebMenuFunction _menuFunction)
{
boolean ret;
ret = super(_menuFunction);
if (_menuFunction.name() == weburlitemstr(EPDocuList) && vendTable.VendGroup == '50')
ret = false;
return ret;
}
public Common setMenuFunctionRecord(WebMenuFunction _menuFunction, Common _cursor)
{
Common ret;
if (_menuFunction.name() == weburlitemstr(EPDocuList))
ret = null;
else
ret = super(_menuFunction, _cursor);
return ret;
}