Cartlanna Catagóire: CAONAIGH

MOSS cinn saincheaptha cuardaigh — Cás a bhfuil tábhacht le i cinn cuardaigh XSLT

Ní féidir liom a mhodhnú chun cinn cuardaigh XSLT go minic, mar sin is cosúil sé cosúil mé ag dreapadh cnoic beag gach uair.

Is é mo ceacht nua seo: Nithe ​​Cás nuair tagairt colún. I mo cuardach casta, Tá mé colúin atá sainmhínithe mar seo a:

<fréimhe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<
Colúin>
<
Colún Ainm="GafTrainingInvoiceNumber" />
<
Colún Ainm="GafTrainingInvoiceLocation" />
<
Colún Ainm="WorkId"/>
<
Colún Ainm="Rangaigh"/>
<
Colún Ainm="Teideal"/>
<
Colún Ainm="Údar"/>
<
Colún Ainm="Méid"/>
<
Colún Ainm="Conair"/>
<
Colún Ainm="Cur Síos"/>
<
Colún Ainm="Scríobh"/>
<
Colún Ainm="SiteName"/>
<
Colún Ainm="CollapsingStatus"/>
<
Colún Ainm="HitHighlightedSummary"/>
<
Colún Ainm="HitHighlightedProperties"/>
<
Colún Ainm="ContentClass"/>
<
Colún Ainm="IsDocument"/>
<
Colún Ainm="PictureThumbnailURL"/>
</
Colúin>
</
fréimhe>

An XLST a thaispeánann an líon sonrasc agus suíomh sonrasc a bhí:

<p>
Training Invoice Number: <XSL:luach-ar roghnú="GafTrainingInvoiceNumber"/>
<
br></br>
Training Invoice Location: <XSL:luach-ar roghnú="GafTrainingInvoiceLocation"/>
</
p>

Mar sin féin, an roghnú Tá chun tagairt an mhaoin i ngach cás íochtair, mar atá i:

<p>
Training Invoice Number: <XSL:luach-ar roghnú="gaftraininginvoicenumber"/>
<
br></br>
Training Invoice Location: <XSL:luach-ar roghnú="gaftraininginvoicelocation"/>
</
p>


Until I corrected that, search results showed the labels (i.e. "Training Invoice Number") but no data.

CAONAIGH / InfoPath Foirmeacha Freastalaí (InfoPath 2007) feidhmíocht liosta anuas

Catagóir bhreise: InfoPath

Achoimre: An InfoPath 2007 foirm imscaradh le freastalaí MOSS soláthraítear liosta anuas na díoltóirí ceangailte le liosta CAONAIGH saincheaptha. Nuair a roghnú díoltóir, rialacha a shannadh luachanna réimse le dornán de réimsí téacs ar nós ainm ionadaithe díolacháin, seoladh, cathair, stáit, zip agus fón. Tá feidhmíocht Uafásach. Faoi deara againn go bhfaigheann feidhmíocht níos measa (in a non-linear fashion) do gach réimse breise againn cothrom le dáta ar an mbealach seo. I.e., má táimid thabhairt cothrom le dáta go díreach an t-ainm ionadaithe díolacháin, a thógann sé [x] méid ama a. Má táimid thabhairt cothrom le dáta díolacháin Ionadaí, address1, address2, cathair, stáit, zip, a thógann sé 10 huaire níos faide.

Réiteach: Scríobh ar an ngréasán (Is féidir le cód samplacha le fáil anseo) go bhfuil ar aghaidh in ainm díoltóir agus tuairisceáin sé ar ais na sonraí díoltóir. Ansin,, shannadh na réimsí ar an mbealach seo. Cé is cosúil seo ró-mhall, ní raibh aon difríocht so-aitheanta ar fheidhmíocht nuair a shanntar againn 1 réimse versus 8 réimsí. Mar buntáiste breise, users get a cool "contacting the server" Cylon éifeacht agus fanacht siad do an fhoirm chun na torthaí seirbhíse agairt agus a ithe.

CAONAIGH: Eisceacht tharla. (Eisceacht ó HRESULT: 0x80020009 (DISP_E_EXCEPTION))

Suas chun dáta: Ní rabhamar chinneadh an bhunchúis an fhadhb seo agus tá sé riamh arís dromchla.

Faoi deara againn le linn chur i bhfeidhm ar shuíomh forbartha go tobann, Tá dhá úsáideoirí in ann rochtain a fháil ar bhailiúchán suíomh. Is féidir na cuntais sin a fhíordheimhniú ar an suíomh is mó, ach nuair a iarraidh rochtain a fháil ar bhailiúchán shuíomh ar leith, siad a fháil ach ar scáileán bán. Aon earráidí ar taispeáint, ach an leathanach bán bán.

Táimid logáil isteach mar admin suíomh bhailiú agus iarracht a chur ar cheann de na úsáideoirí mar admin suíomh agus an uair seo, ar an cnaipe "OK", a fhaigheann muid an teachtaireacht seo:

Eisceacht tharla. (Eisceacht ó HRESULT: 0x80020009 (DISP_E_EXCEPTION))

Chaith muid tamall taighde seo agus ar an drochuair, ní raibh teacht suas le rud ar bith úsáideach. Bhí roinnt teachtaireachtaí i log diagnóiseacha, ach bhí sé deacair a gcomhchoibhneas go díreach acu leis an gceist seo.

Sa deireadh, scriosadh againn ar an suíomh seo a bhailiú agus a ath-chruthaigh sé agus gur réiteach é.

Má figiúr mé amach cad ba chúis leis seo sa todhchaí, Feicfidh mé an post seo cothrom le dáta.

CAONAIGH: Iterating trí liostaí saincheaptha agus ag filleadh sonraí scagtha a InfoPath

Cás Gnó:

A sholáthar ar mhodh a chuireann ar chumas úsáideoirí a chur isteach foréilimh a cheannach cruinn go tapa.

Fadhb Gnó:

Dhéanann an cliant gnó le cúpla céad díoltóirí.

Vendors are "type" sonracha. Ciallaíonn sé seo go sells díoltóir threalamh ríomhaireachta (e.g. Dell) nó soláthairtí oifige (e.g. Staples).

How do we enable end users who create purchase requisitions select a valid vendor?

Réiteach Gnó:

Differentiate vendors in the system via "type".

Enable users to select the "type" of product and then provide a filtered set of appropriate vendors.

Réiteach Teicniúil:

An InfoPath form has been designed that enables users to enter online purchase requisitions.

Two InfoPath selection lists control vendor selection. An Chéad, the user selects a "purchase type". This limits a second selection list to contain only vendors that sell for that purchase type. This is a classic cascading drop-down.

Vendors are stored in a MOSS custom list with custom columns for vendor attributes such as name, address and especially "type".

Implement a web service for an InfoPath client to consume that iterates through the custom vendor list, returning only vendors matching a supplied "type".

Invoke the web service via the InfoPath form.

Ceachtanna a Foghlaimíodh:

  • An Chéad, it seems necessary to go this route. I would have preferred to do the filtering entirely within InfoPath and not create any web service functionality here. Mar sin féin, forms server does not provide the required filtering capability. We can put a rule onto a the "type" selection list in the form to sort of re-open the vendor query, but we can’t get it to work properly. Dá bhrí sin,, it was necessary to implement the web service.
  • This is a classic "cascading selection list" problem in the InfoPath forms server world and there are many good examples out there that explain how to solve this.
  • A blank value for a column in the vendor list does not return an empty string when referenced like this: initItem["Vendor Name"]. Ina áit sin, it returns a null.

Some other Notes:

  • I return an array[] of vendors because I had some difficulty returning an ArrayList. InfoPath was complaining about it and I didn’t have the time or the inclination to fight over it. Seo, ar ndóigh, puts an artificial limit on the total number of vendors. It also compelled me to implement a trim() method on the array because I hate the idea of returning back 100’s of null vendors. InfoPath doesn’t care, but it nagged at me. (Arís, this was easier than fighting InfoPath over ArrayLists).
  • I implemented a GetSpecificVendorByName() function as well, which may be instructive.

An Cód:

ag baint úsáide as Córas;
ag baint úsáide as System.Web;
ag baint úsáide as System.Web.Services;
ag baint úsáide as System.Web.Services.Protocols;
ag baint úsáide as Microsoft.SharePoint;
ag baint úsáide as System.Configuration;

/// <achoimre>
///
Vendor Service: Provides vendor related services which today are consumed by an infopath client form.
///
/// History:
/// ——–
/// 07/24/07: Initial coding, Paul J. Gavin of Conchango.
///
/// </achoimre>
[WebService(Namespace = "http://www.conchango.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
poiblí ranga VendorService : System.Web.Services.WebService
{

/// <achoimre>
/// Represents a vendor from a custom sharepoint list maintained by MSUSA.
/// </achoimre>
poiblí ranga Vendor
{
poiblí Vendor() { }

poiblí Vendor(Spit initItem)
{
más rud é (! (initItem["Vendor Name"] == náid)) VendorName = initItem["Vendor Name"].ToString();
más rud é (! (initItem["Address 1"] == náid)) VendorAddress1 = initItem["Address 1"].ToString();
más rud é (! (initItem["Address 2"] == náid)) VendorAddress2 = initItem["Address 2"].ToString();
más rud é (! (initItem["City"] == náid)) VendorCity = initItem["City"].ToString();
más rud é (! (initItem["VendorPhone"] == náid)) VendorPhone = initItem["VendorPhone"].ToString();
más rud é (! (initItem["PurchaseType"] == náid)) VendorType = initItem["PurchaseType"].ToString();
más rud é (! (initItem["State"] == náid)) VendorState = initItem["State"].ToString();
más rud é (! (initItem["Zip"] == náid)) VendorZip = initItem["Zip"].ToString();
más rud é (!(initItem["Fax"] == náid)) VendorFax = initItem["Fax"].ToString();
más rud é (!(initItem["SalesRepName"] == náid)) VendorSalesRepName = initItem["SalesRepName"].ToString();

VendorItemId = initItem.ID; // Unique ID maintained via MOSS.
}

poiblí int VendorItemId;
poiblí teaghrán VendorName;
poiblí teaghrán VendorAddress1;
poiblí teaghrán VendorAddress2;
poiblí teaghrán VendorCity;
poiblí teaghrán VendorState;
poiblí teaghrán VendorZip;
poiblí teaghrán VendorPhone;
poiblí teaghrán VendorType;
poiblí teaghrán VendorSalesRepName;
poiblí teaghrán VendorFax;
}

poiblí VendorService () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

príobháideach Vendor[] GenerateTestVendors()
{
Vendor[] resultList;
resultList = nua Vendor[100];

Vendor v;
v = nua Vendor();
v.VendorAddress1 = "v1_address1";
v.VendorAddress2 = "v1_address2";
v.VendorCity = "v1_city";
v.VendorName = "v1_vendorname";
v.VendorPhone = "v1_vendorphone";
v.VendorState = "v1_st";
v.VendorType = "v1_type";
v.VendorZip = "v1_zip";

resultList[0] = v;

v = nua Vendor();

v.VendorAddress1 = "v2_address1";
v.VendorAddress2 = "v2_address2";
v.VendorCity = "v2_city";
v.VendorName = "v2_vendorname";
v.VendorPhone = "v2_vendorphone";
v.VendorState = "v2_st";
v.VendorType = "v2_type";
v.VendorZip = "v2_zip";

resultList[1] = v;

v = nua Vendor();
v.VendorAddress1 = "v3_address1";
v.VendorAddress2 = "v3_address2";
v.VendorCity = "v3_city";
v.VendorName = "v3_vendorname";
v.VendorPhone = "v3_vendorphone";
v.VendorState = "v3_st";
v.VendorType = "v3_type";
v.VendorZip = "v3_zip";

resultList[2] = v;

ar ais resultList;

}

[WebMethod]
poiblí Vendor GetSpecificVendorById(int vendorId)
{
teaghrán SpVendorSiteName; // Name of the actual MOSS site that hosts the vendor custom list.
teaghrán SpVendorListName; // Name of the actual MOSS list containing vendors.

SpVendorSiteName = ConfigurationSettings.AppSettings["VendorListHostingSite"].ToString();
SpVendorListName = ConfigurationSettings.AppSettings["VendorList"].ToString();

ag baint úsáide as (SPSite site = nua SPSite(SpVendorSiteName))
{

ag baint úsáide as (SPWeb web = site.OpenWeb())
{

SPList currentList = web.Lists[SpVendorListName];

Spit specificItem = currentList.Items[vendorId];

ar ais nua Vendor(specificItem);

} // using spweb web = site.openweb()
} // using spsite site = new spsite("http://localhost/mizuho")

}

[WebMethod]
// Assumes that the vendor name is unique, from a business perspective
poiblí Vendor GetSpecificVendorByVendorName(teaghrán vendorName)
{
teaghrán SpVendorSiteName; // Name of the actual MOSS site that hosts the vendor custom list.
teaghrán SpVendorListName; // Name of the actual MOSS list containing vendors.

SpVendorSiteName = ConfigurationSettings.AppSettings["VendorListHostingSite"].ToString();
SpVendorListName = ConfigurationSettings.AppSettings["VendorList"].ToString();

ag baint úsáide as (SPSite site = nua SPSite(SpVendorSiteName))
{
ag baint úsáide as (SPWeb web = site.OpenWeb())
{

SPList currentList = web.Lists[SpVendorListName];

foreach (Spit vendorItem i currentList.Items)
{
más rud é (vendorItem["Vendor Name"] == náid) leanúint;

más rud é (vendorItem["Vendor Name"].ToString().Cothrom(vendorName))
ar ais nua Vendor(vendorItem);
}

Vendor v = nua Vendor();
v.VendorPhone = "not found: " + vendorName;

ar ais v;

ar ais náid;

} // using spweb web = site.openweb()
} // using spsite site = new spsite("http://localhost/mizuho")

} // modh

[WebMethod]
poiblí Vendor[] GetVendorsOfType (teaghrán filterType)
{

teaghrán SpVendorSiteName; // Name of the actual MOSS site that hosts t
he vendor custom list.
teaghrán SpVendorListName; // Name of the actual MOSS list containing vendors.

SpVendorSiteName = ConfigurationSettings.AppSettings["VendorListHostingSite"].ToString();
SpVendorListName = ConfigurationSettings.AppSettings["VendorList"].ToString();

Vendor[] resultList;
int vendorIndex = 0;
resultList = nua Vendor[1000];

// Initialize the list with a default friendly message.
Vendor v = nua Vendor();
v.VendorName = "Select a vendor type to populate this list.";
resultList[0] = v;

// Convert the filter to lower case for easier string comparison later.
filterType = filterType.ToLower();

// If the filter type passed is "test", generate some simple data.
#réigiún Filter type = "test"
más rud é (filterType.Equals("test"))
ar ais GenerateTestVendors();
#endregion

más rud é (fíor)
{
ag baint úsáide as (SPSite site = nua SPSite(SpVendorSiteName))
{
ag baint úsáide as (SPWeb web = site.OpenWeb())
{

v = náid;

SPList currentList = web.Lists[SpVendorListName];

// Iterate through all the items in the vendor list.
foreach (Spit vendorItem i currentList.Items)
{

teaghrán lowerVendorType;

lowerVendorType = vendorItem["PurchaseType"].ToString().Ní eagar();
lowerVendorType = lowerVendorType.Substring(3);

más rud é (lowerVendorType.Equals(filterType))
{
resultList[vendorIndex ] = nua Vendor(vendorItem);
}
} // iterating thru all the vendors in the list


ar ais TrimVendorArray(vendorIndex, resultList);
// return resultList;

} // using spweb web = site.openweb()
} // using spsite site = new spsite("http://localhost/mizuho")

} // if true

ar ais náid;
}

príobháideach Vendor[] TrimVendorArray(int newsize, Vendor[] originalVendorArray)
{
Vendor[] trimmedArray;

más rud é (newsize == 0) newsize = 1;
trimmedArray = nua Vendor[newsize];

int currentCounter = 0;

le haghaidh (currentCounter = 0; currentCounter < newsize; currentCounter )
{
trimmedArray[currentCounter] = originalVendorArray[currentCounter];
}

ar ais trimmedArray;

}
}