search-form-inputs tag not working properly with econditions - moqui

i'm doing an entity-find with econditions and I put the result list in a form-list element on my page. I want the ability of sorting on columns so i've put a <search-form-inputs/> tag at the end of my entity-find.
the problem is that the entity-find doesn't work properly for the econditions I've included (Its results are not what they are supposed to be!)
and when I remove the <search-form-inputs/> tag everything just works fine.
any suggestions? maybe I'm not using this tag in the right way.
<entity-find entity-name="me.myJointView" list="itmTemp" distinct="true">
<econdition field-name="myId" operator="less-equals" from="rNTo" ignore-if-empty="true"/>
<econdition field-name="myId" operator="greater-equals" from="rNFrom" ignore-if-empty="true"/>
<econdition field-name="myName" from="fName" ignore-if-empty="true"/>
<econdition field-name="mySurname" from="lName" ignore-if-empty="true"/>
<econdition field-name="myDate" operator="less-equals" from="aDTo" ignore-if-empty="true"/>
<econdition field-name="someId" operator="equals" from="so" ignore-if-empty="true"/>
<econdition field-name="someOtherId" operator="equals" from="rm" ignore-if-empty="true"/>
<econditions combine="or">
<econdition field-name="myStateEnumId" operator="equals" value="something"/>
<econdition field-name="myStateEnumId" operator="equals" value="somethingElse"/>
</econditions>
<econditions combine="or">
<econditions combine="and">
<econdition field-name="aDate" from="null"/>
<econdition field-name="myDate" operator="greater-equals" to-field-name="aDate"/>
</econditions>
<econditions combine="and">
<econdition field-name="myDate" operator="less-equals" to-field-name="dDate"/>
<econdition field-name="myDate" operator="greater-equals" to-field-name="aDate"/>
</econditions>
</econditions>
<search-form-inputs/>
<select-field field-name="myId"/>
<select-field field-name="myName"/>
<select-field field-name="mySurname"/>
<select-field field-name="MyDate"/>
<order-by field-name="myDate,RECETEST.lastUpdatedStamp"/>
</entity-find>

Have a look at what is in your context and you will see exactly what is happening to elicit that behaviour. (e.g. you could use the 'label' tag on your screen to return "== ${context} ==" etc.).
And if you only want column sorting then make your own input-fields-map like [orderByField:ec.web.parameters.orderByField], and put your default-order-by in with search-form-inputs too.
<search-form-inputs input-fields-map="xxx" default-order-by="xxx" />

I had a form-list in my screen that its column names was identical to the fields I set econditions on. something like:
<form-list name="list" list="receptions" headre-dialog="true" paginate="true">
<field name="mySurname" skip-form="false">
<header-field show-order-by="true"><text-find hide-options="true"/></header-field>
<default-field><display/></default-field>
</field>
<field name="myDate" skip-form="false">
<header-field show-order-by="true"><text-find hide-options="true"/></header-field>
<default-field><display/></default-field>
</field>
<field name="editButton">
<default-field>
<link url="edit" parameter-map="[myId:myId]" icon="glyphicon glyphicon-pencil" btn-type="info" />
</default-field>
</field>
<form-list-column>
<field-ref name="myId" skip-form="true"/>
</form-list-column>
<form-list-column>
<field-ref name="myName"/>
</form-list-column>
<form-list-column>
<field-ref name="mySurname"/>
</form-list-column>
<form-list-column>
<field-ref name="myDate"/>
</form-list-column>
<form-list-column>
<field-ref name="editButton"/>
</form-list-column>
<field-layout>
<fields-not-referenced/>
<field-row>
<field-ref name="myId"/>
<field-ref name="myName"/>
<field-ref name="mySurname"/>
<field-ref name="myDate"/>
<field-ref name="editButton"/>
</field-row>
</field-layout>
</form-list>
I added the line below and removed orderBy statement at the end of my entity-find:
<search-form-inputs input-fields-map="[orderByField:ec.web.parameters.orderByField]" default-order-by="myDate,myId,mySurname,myName,myDate" />
and checked from the query stats screen that the query produced by the two entity-finds in this topic are the same (apart from the orderBy statement added in the new query) except that:
1- the entity-find in this post add a "limit 20 offset 0" at the end of the query (which i can handle by setting a high limit)
2- I can't orderBy RECETEST.lastUpdatedStamp (which I used at the entity-find definition in the main question) anymore. AND I NEED THIS FUNCTIONALITY! WHAT SHOULD I DO?

Related

Lucene query results not correct for long and double values

I use Lucene 6.1.0 to index elements with a name and a value.
E.g.
<documents>
<Document>
<field name="NAME" value="Long_-1"/>
<field name="VALUE" value="-1"/>
</Document>
<Document>
<field name="NAME" value="Double_-1.0"/>
<field name="VALUE" value="-1.0"/>
</Document>
<Document>
<field name="NAME" value="Double_-0.5"/>
<field name="VALUE" value="-0.5"/>
</Document>
<Document>
<field name="NAME" value="Long_0"/>
<field name="VALUE" value="0"/>
</Document>
<Document>
<field name="NAME" value="Double_0.0"/>
<field name="VALUE" value="0.0"/>
</Document>
<Document>
<field name="NAME" value="Double_0.5"/>
<field name="VALUE" value="0.5"/>
</Document>
<Document>
<field name="NAME" value="Long_1"/>
<field name="VALUE" value="1"/>
</Document>
<Document>
<field name="NAME" value="Double_1.0"/>
<field name="VALUE" value="1.0"/>
</Document>
<Document>
<field name="NAME" value="Double_1.5"/>
<field name="VALUE" value="1.5"/>
</Document>
<Document>
<field name="NAME" value="Long_2"/>
<field name="VALUE" value="2"/>
</Document>
</documents>
According to the documentation I use the LongPoint and DoublePoint to build the index.
public static void addLongField(String name, long value, Document doc) {
doc.add(new LongPoint(name, value));
// since Lucene6.x a second field is required to store the values.
doc.add(new StoredField(name, value));
}
public static void addDoubleField(String name, double value, Document doc) {
doc.add(new DoublePoint(name, value));
// since Lucene6.x a second field is required to store the values.
doc.add(new StoredField(name, value));
}
Since I use the same field for long and double values, I get strange results for my RangeQuery if the min and max value have different signs.
LongPoint.newRangeQuery(field, minValue, maxValue);
DoublePoint.newRangeQuery(field, minValue, maxValue);
This example is correct:
VALUE:[1 TO 1] VALUE:[0.5 TO 1.0]
Results in:
0.5 Double_0.5
1 Long_1
1.0 Double_1.0
This example is erroneous
VALUE:[0 TO 1] VALUE:[-0.5 TO 1.0]
Results in:
0 Long_0
0.0 Double_0.0
1 Long_1
-1 Long_-1
-0.5 Double_-0.5
0.5 Double_0.5
1.0 Double_1.0
2 Long_2
Additionally to the correct results, all long values are returned.
Does anybody know why?
Is it not possible to store long and double values in the same field?
Thank you very much.
BR Tobias
No, you should not be keeping different data types in the same field. You should either put them in separate fields, or convert your longs into doubles (or vice versa), so that they are all indexed in the same format.
To understand what is going on, it helps to understand what the numeric fields are really doing. Numeric fields are encoded in a binary representation that facilitates range searching for that type. The encoding for integral types and that for floating point types is not comparable. For an example, for the number 1:
long 1 = lucene BytesRef: [80 0 0 0 0 0 0 1]
double 1.0 = lucene BytesRef: [bf f0 0 0 0 0 0 0]
These BytesRef binary representations are what is actually being searched. Since one part of your query is from double -0.5 to 1.0, you are effectively running a query:
encodedvalue: [40 1f ff ff ff ff ff ff] - [bf f0 0 0 0 0 0 0]
Which doesn't include just a few extra hits out of the range of long values, but most of the long values outside of the really high and low reaches (you'd need to be getting into the neighborhood of Long.MAX_VALUE/2).

Search not working (as expected) for list-form PartyListForm - column loaded from mantle.party.PartyIdentification

I started by using PartyListForm in FindParty.xml. This list loads data related to parties, in my case with Supplier role. I added a new column with an ID from mantle.party.PartyIdentification, with specific partyIdTypeEnumId. The result is satisfactory, I have a list of Suppliers, with their names and respective IDs shown. The problem starts in the moment, when I want to let the user search through those IDs. It does not work. This is the definition of the column:
<field name="idValue">
<header-field title="Company ID" show-order-by="true">
<text-find size="30" hide-options="true"/>
</header-field>
<default-field>
<display text="${partyIdentification?.idValue?:'N/a'}" text-map="partyIdentification"/>
</default-field>
</field>
This is where the data (text-map="partyIdentification") comes from:
<row-actions>
<entity-find-one entity-name="mantle.party.PartyDetail" value-field="party"/>
<entity-find-one entity-name="mantle.party.PartyIdentification" value-field="partyIdentification">
<field-map field-name="partyId" from="partyId"/>
<field-map field-name="partyIdTypeEnumId" value="PtidICO"/>
</entity-find-one>
<entity-find-count entity-name="mantle.party.PartyInvoiceDetail" count-field="invCount">
<econdition field-name="partyId" operator="equals" from="partyId"/>
</entity-find-count>
</row-actions>
This is how it looks on the screen
#David's comment:
There is the original search commented out and my attempt:
<!--<service-call name="mantle.party.PartyServices.find#Party" in-map="context + [leadingWildcard:true, orderByField:'^organizationName', roleTypeId:'Supplier', pageSize:7]" out-map="context"/>-->
<service-call name="mantle.party.PartyServicesEnhancements.findEnhanced#Party" in-map="context + [leadingWildcard:true, orderByField:'^organizationName', roleTypeId:'Supplier', pageSize:7]" out-map="context"/>
I made a few changes by adding new components as a copy of existing ones, namely:
new view-entity with entity-name="FindPartyViewEnhanced" in package="mantle.party as copy of "FindPartyView" with these additions:
<member-entity entity-alias="IDNTF" entity-name="PartyIdentification" join-from-alias="PTY">
<key-map field-name="partyId" related="partyId" />
<entity-condition>
<econdition field-name="partyIdTypeEnumId" operator="equals" value="PtidICO"/>
</entity-condition>
</member-entity>
<alias entity-alias="IDNTF" name="idValue" field="idValue"/>
<alias entity-alias="IDNTF" name="partyIdTypeEnumId" field="partyIdTypeEnumId"/>
new service "findEnhanced" noun="Party" type="script" as a copy of find#Party service with new parameter added:
<parameter name="idValue"/>
new findPartyEnhanced.groovy (copy of findParty.groovy) with a single line added:
if (idValue) { ef.condition(ec.entity.conditionFactory.makeCondition("idValue", EntityCondition.LIKE, (leadingWildcard ? "%" : "") + idValue + "%").ignoreCase()) }
and finally, in the row actions of the screen, where the search is situated, this is what I ended up with:
<service-call name="mantle.party.PartyServicesEnhancements.findEnhanced#Party" in-map="context + [leadingWildcard:true, idValue:idValue, orderByField:'organizationName', roleTypeId:'Supplier', pageSize:7]" out-map="context"/>
Most probably, this is not the best solution, but it worked for me. Hopefully, it will help you as well.

How can I highlight syntax in Microsoft OneNote 2013?

I want to highlight syntax for my programming language of choice (proprietary) in Microsoft OneNote 2013 with a macro or script. I found a free Macro creator for MS OneNote '13 that allows creation of custom macros called "OneTastic". I created a macro that is given two arrays with lists of predefined words associated with different colors to give each list (ex: List 1 words = blue, list 2 words = orange, etc.)
API: https://www.omeratay.com/onetastic/docs/
Problem: The search logic is finding words inside of bigger words, like "IN" inside of the word "domain" (domaIN). My code is below:
<?xml version="1.0" encoding="utf-16"?>
<Macro name="CCL TEST 3" category="Color" description="" version="10">
<ModifyVar name="KEYWORDS1" op="set">
<Function name="String_Split">
<Param name="string" value="drop create program go %i declare call set end END execute else elseif protect constant curqual of subroutine to noconstant record free range in is protect define macro endmacro" />
<Param name="delimiter" value=" " />
</Function>
</ModifyVar>
<ModifyVar name="counter" op="set" value="0" />
<WhileVar name="counter" op="lt">
<Function name="Array_Length">
<Param name="array" var="KEYWORDS1" />
</Function>
<IsRootOp />
<ModifyVar name="keyword" op="set" var="KEYWORDS1">
<RightIndex var="counter" />
</ModifyVar>
<For each="Text">
<That hasProp="value" op="eq" var="keyword" />
<ModifyProp name="fontColor" op="set" value="blue" />
</For>
<ModifyVar name="counter" op="add" value="1" />
</WhileVar>
<ModifyVar name="KEYWORDS2" op="set">
<Function name="String_Split">
<Param name="string" value="datetimefind datetimediff cnvtdatetime cnvtalias format build concat findfile error alterlist alter initrec cnvtdate esmError echo max min avg sum count uar_get_code_meaning mod substring size trim hour day isnumeric expand locateval cnvtstring fillstring btestfindstring logical uar_get_code_display uar_get_meaning_by_codeset UAR_GET_CODE_BY sqltype cnvtreal echorecord cnvtupper cnvtlower cnvtdatetimeutc abs datetimediff year julian btest decode evaluate findstring asis replace validate nullterm parser value uar_timer_create uar_CreatePropList uar_SetPropString uar_CloseHandle uar_Timer_Destroy uar_Timer_Stop build2 patstring piece cnvtalphanum timestampdiff" />
<Param name="delimiter" value=" " />
</Function>
</ModifyVar>
<ModifyVar name="counter2" op="set" value="0" />
<WhileVar name="counter2" op="lt">
<Function name="Array_Length">
<Param name="array" var="KEYWORDS2" />
</Function>
<IsRootOp />
<ModifyVar name="keyword" op="set" var="KEYWORDS2">
<RightIndex var="counter2" />
</ModifyVar>
<For each="Text">
<That hasProp="value" op="eq" var="keyword" />
<ModifyProp name="fontColor" op="set" value="orange" />
</For>
<ModifyVar name="counter2" op="add" value="1" />
</WhileVar>
</Macro>
There is no such inbuilt feature available in OneNote but you can do it.
Use Visual Studio Code, it's free. Turn on right text copy/pasting. Write your code in in VS code. Copy it. It'll paste exactly as you see. Colors and all.
While this does not use VBA, I use and love the add-in NoteHightlight2016
If you don't find a language you can go through and add your own. I've added the Excel Formula keywords to the languages supported and I believe it is a bit easier than creating in OneTastic, which I also use and love.

PairSet repetition in ttf font GPOS table

I am reading ttf specification and realizing the parser. But I have encountered a problem of parsing 'GPOS' table.
This is the link to GPOS table specification: http://www.microsoft.com/typography/otspec/gpos.htm
It says:
ValueFormat2 applies to the ValueRecord of the second glyph in each pair. ValueRecords for all second glyphs must use ValueFormat2. If ValueFormat2 is set to null, then the second glyph of the pair is the “next” glyph for which a lookup should be performed.
My first question: What would happen when 'ValueFormat2' is 'null'? Is it the same with 'ValueFormat1'? If so, why the spec using different expressions?
Compared with the .ttx file generated by ttx, I find that there are repetitions of PairSet in GPOS section. But my parser couldn't read out such repetitions from ttf binary file. For example: times.ttf on Windows7. File 'time.ttx' has the following items, but my parser reads out 'index 13', then the next group is 'index 16', which means I have missed 'index 14' and 'index 15'. And I don't know why I cannot read out the same result as ttx does.
My second question: Is there anything I have missed from the ttf specification? Which and where are such repetitions explained? Thanks in advance!
<PairSet index="13">
<!-- PairValueCount=2 -->
<PairValueRecord index="0">
<SecondGlyph value="comma"/>
<Value1 XAdvance="-133"/>
</PairValueRecord>
<PairValueRecord index="1">
<SecondGlyph value="period"/>
<Value1 XAdvance="-133"/>
</PairValueRecord>
</PairSet>
<PairSet index="14">
<!-- PairValueCount=2 -->
<PairValueRecord index="0">
<SecondGlyph value="comma"/>
<Value1 XAdvance="-133"/>
</PairValueRecord>
<PairValueRecord index="1">
<SecondGlyph value="period"/>
<Value1 XAdvance="-133"/>
</PairValueRecord>
</PairSet>
<PairSet index="15">
<!-- PairValueCount=2 -->
<PairValueRecord index="0">
<SecondGlyph value="comma"/>
<Value1 XAdvance="-133"/>
</PairValueRecord>
<PairValueRecord index="1">
<SecondGlyph value="period"/>
<Value1 XAdvance="-133"/>
</PairValueRecord>
</PairSet>
<PairSet index="16">
<!-- PairValueCount=1 -->
<PairValueRecord index="0">
<SecondGlyph value="quoteleft"/>
<Value1 XAdvance="-152"/>
</PairValueRecord>
</PairSet>

2 series on my chart

I would like to show 2 series on the same chart, however I'm not sure how to update the following code:
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="UcSalesSeries.ascx.cs" Inherits="Silverlight.ConfigEnhanced.Web.UcSalesSeries" %>
<asp:Chart ID="Chart1" runat="server" DataSourceID="LinqDataSource1"
Height="500px" Width="750px" >
<Series>
<asp:Series ChartType="Line" Name="Series1" XValueMember="EndOfMonth"
YValueMembers="Quantity" >
</asp:Series>
</Series>
<Series>
<asp:Series ChartType="Line" Name="Series2" XValueMember="EndOfMonth"
YValueMembers="Quantity" >
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</ChartAreas> <Legends>
<asp:Legend TableStyle="Auto" Docking="Top" >
</asp:Legend>
</Legends>
</asp:Chart>
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="Data.DataClasses1DataContext" EntityTypeName="" Select="new (EndOfMonth, Quantity)"
TableName="T_SalesDatas" OrderBy="EndOfMonth" Where="Model == #Model">
<WhereParameters>
<asp:Parameter DefaultValue="XXS" Name="Model" Type="String" />
</WhereParameters>
</asp:LinqDataSource>
the second serie I would like to see is the same as above, but I would be changing the parameter
<asp:Parameter DefaultValue="NEWVALUE" Name="Model" Type="String" />
The Chart does not support multiple DataSources so you will need to manually add the points from code behind to the chart when rendering the page. You create two tables from your data with the different parameters and iterate each table and adding them to the chart manually.
Read more in the section 'Manual' series population on this MSDN blog:
http://blogs.msdn.com/b/alexgor/archive/2009/02/21/data-binding-ms-chart-control.aspx