Search in the product index BL.Prod,Prod.Product 1 %RegisteredObject 0 S N A K I R L T B N F D E L KortTekst ProductNr IdentNr KlantRef LevRef LangTekstN LangTekstF LangTekstD LangTekstE LangTekstR Klassificatie Boom StockType Actief KS 2 3 4 5 6 7 8 9 10 11 900 200 OEI 1 %Query pxCriteria:BL.Prod.sub.pxSearchCriteria,pxFormat:BL.Prod.sub.pxSearchFormat 1 %Status ..#LijnMax %psLijnMax=..#LijnMax Set %psCriteria=Criteria Set %psFormatCompact=Format.FormatCompact Set:(%psFormatCompact="")||(%psFormatCompact=$C(0)) %psFormatCompact=..#foKortTekst_";"_..#foLangTekstN_";"_..#foStockType_";"_..#foActief Set %psFormatExpand=Format.FormatExpand Set:(%psFormatExpand="")||(%psFormatExpand=$C(0)) %psFormatExpand=..#foKortTekst_";"_..#foLangTekstF_";"_..#foLangTekstN_";"_..#foKortTekst_";"_..#foLevRef_";"_..#foKlantRef_";"_..#foKlassificatie Set %psSortKey="" Quit $$$OK ]]> 1 SelectExecute 0 %Status %psLijnMax) Do . Set AtEnd=1 Else Do . Set Row=..SelectRow(%psResult(%psSortKey),%psKlantNr) . If Row="" Set AtEnd=1 Quit $$$OK ]]> 1 SelectExecute %Status 1 PRNr,KLNr 0 1 PRNr,KLNr,FormatCompact 0 "_..GetColVal(PRNr,KLNr,Format)_"" . Else Do .. Set Tekst=Tekst_"
  "_..GetColVal(PRNr,KLNr,Format) Quit Tekst ]]>
1 PRNr,KLNr,FormatExpand 0 Retrieve values for each column 1 PRNr,KLNr,Format:%String %String ",1) Quit:(Format=..#foLangTekstF) ##class(Prod.ProductTekst).GetOmschrijvingViaPRNr(PRNr,"F","
",1) Quit:(Format=..#foLangTekstD) ##class(Prod.ProductTekst).GetOmschrijvingViaPRNr(PRNr,"D","
",1) Quit:(Format=..#foLangTekstE) ##class(Prod.ProductTekst).GetOmschrijvingViaPRNr(PRNr,"E","
",1) Quit:(Format=..#foLangTekstR) ##class(Prod.ProductTekst).GetOmschrijvingViaPRNr(PRNr,"BR","
",1) Quit:(Format=..#foKlassificatie) $$DISPL^KLASS($$$PRGet($$$KlassificatieKey)) Quit:(Format=..#foBoom) "" If Format=..#foStockType Do Quit ColVal . Set ColVal=$$$PRGet($$$StockType) . Set ColVal=$S(($P($G(^KPR(PRNr,0)),"\",3)?4.7N):"Afgeleid",ColVal="1":"Stock",1:"Niet stock") Quit:(Format=..#foActief) $S($$$PRGet($$$NONAktief):"Niet actief",1:"Actief") Quit:(Format=..#foKS) "" Quit "(format '"_Format_"' undefined)" ]]>
==================================================================================================================== Important remark: The storage location of the persistent object ^Prod.SearchIndex is used directly !!! Opgelet : De global gebruikt voor opslag van persistenobject ^Prod.SearchIndex wordt hier rechtstreeks gebruikt !!! 1 Afgeleide van SearchIndex die LB quit ipv Array 1 pxCriteria:BL.Prod.sub.pxSearchCriteria %List 3000) pxCriteria.MaxCount=3000 ; 3000 producten*10 bytes = 30KB wat een max. is voor een string Do ..SearchIndex(pxCriteria,.arProducts) Set lbResult = "" Set Index="" For Set Index=$O(arProducts(Index)) Quit:Index="" Do . Set lbResult = lbResult _ $LB(arProducts(Index)) Quit lbResult ]]> ==================================================================================================================== r i d ##Class(BL.Prod.Search).TransformToPattern(i,.b,.p,.k) w " -b:",b," -p:",p," -k:",k,! 1 Numerieke tabel opmaken 1 Result,LijnCnt 0 1 pxCriteria,PRNr,Result,LijnCnt,Content 0 1 PRNr 0 On the forehand the default setting depending on the usage. The settings are hardcoded but could as easily subtracted from a database. 1 pxCriteria:BL.Prod.sub.pxSearchCriteria Quickchecks of the SearchCriteria, those elements that can be found directly in the search index datastructure 1 PRNr:%Integer,pxCriteria:BL.Prod.sub.pxSearchCriteria,lbIndexContent:%List Product is already bought by the customer 1 PRNr,KLNr Select on criteria that are not available in the search index 1 PRNr:%Integer,pxCriteria:BL.Prod.sub.pxSearchCriteria 0 %Boolean s lb=##class(BL.Prod.Search).GetVervangProductIfFirstTime(508925,2886) 1 PRNr,KLNr %List niet gekocht If LastSellingDate'="",$$INTDATE^vhDTyp(LastSellingDate,"DKP")>StartDate Quit "" Quit ..GetVervangProduct(PRNr,KLNr,12) ]]> 1 PRNr,KLNr,NumberOfMonths %List ==================================================================================================================== 1 1 Criteria:BL.Prod.sub.pxSearchCriteria,PRNr:%Integer %Boolean ==================================================================================================================== 1 Set Taal=Criteria.SubAt ; Taal of Lev.langtekst Set Taal="N" //Criteria.Language Set:Taal="" Taal="N" Set StockType=Criteria.StockType /// JBL - 2011-06-10 : invalid Oref : Do ..TransformToPattern(ZoekKey,.%PatternKey,.KeepChar) Do ..TransformToPattern(Criteria,.%PatternKey,.KeepChar) Set PRNr=0 For Set PRNr=$O(^KPR(PRNr)) Quit:PRNr="" Do . Quit:(StockType'["A")&&($P($G(^KPR(PRNr,0)),"\",3)?4.7N) . Set Stock=$$$PRGet($$$StockType) . Quit:(StockType'["S")&&Stock . Quit:(StockType'["N")&&'Stock . Set %Key=$ZCVT($ZSTRIP(##class(Prod.ProductTekst).GetOmschrijvingViaPRNr(PRNr,Taal,"~",1),"*P",,KeepChar),"U") . /// JBL + 2011-06-10 : %OK in orde zetten . S %OK=%Key[%PatternKey . Quit:'%OK . ;Quit:'%blProduct.IsAllowed(PRNr) . Set Result(..SortKey(PRNr))=PRNr ]]>