I'm trying to do the following in Freemarker via NetSuite:
I have the following data on a transaction record i.e. imagine a payment record with a number of lines
Doc No. Amount
1 100
1 100
2 50
3 200
4 50
4 25
5 1000
and I want to be able to output:
Doc No. Total
1 200
2 50
3 200
4 75
5 1000
I think you need to use #list and #assign but not sure??
Here is a snippet that should help out with this question (I hope). This is pulled from one of my PDF templates, where I'm adding up the locationTotal variable.
<#list record.item as item>
<#assign currentLocation=item.custcol_location>
<#if currentLocation=="">
<#assign currentLocation=record.entity>
</#if>
<#if item.itemtype!="Discount" && locationsProcessed?seq_index_of(currentLocation)==-1>
<#assign locationTotal=0>
<#list record.item as item2>
<#assign compareLocation=item2.custcol_location>
<#if compareLocation=="">
<#assign compareLocation=record.entity>
</#if>
<#if compareLocation==currentLocation>
<#assign locationTotal=locationTotal+item2.amount>
</#if>
</#list>
<#assign newList=newList+[{"location":currentLocation,"total":locationTotal}] >
<#assign locationsProcessed=locationsProcessed+[currentLocation] >
</#if>
</#list>
Related
I been doing a tutorial and have been caught up in a headache bug for 3 days.
My values aren't being iterated:
<Select value={item.quantity} onChange={(e) =>updateCartHandler(item, e.target.value)}>
{[...Array(item.countInStock).keys()].map((num) => (<MenuItem key={num + 1} value={num + 1}>{num + 1}</MenuItem>))}</Select>
It only outputs : 1.
Should give a list from 1...20
For Ex. I have an arraylike this cids:Array=[{Id:1},{Id:2},{Id:3},{Id:4},{Id:5},{Id:6},{Id:7}---------etc..]
I want output as :
1 2 3 4
5 6 7 8
9
Using *ngFor in angular 4
One way is to convert your arrray[] in array[][4]. And then you will be able to use an imbricated ngFor (ngFor in another ngFor)
Pseudo code :
ngFor* {
ngFor* {
print value;
insert a space;
}
Insert a return line;
}
<span *ngFor="let cid of cids">
{{cid.Id}}
<br *ngIf="(cid.Id)%4==0" />
</span>
<ion-grid no-padding>
<ion-row>
<ion-col>col 1</ion-col>
<ion-col>col 2</ion-col>
<ion-col>col 3</ion-col>
</ion-row>
</ion-grid>
Above code works good, its respective styles are applied, but, below one doesn't work.
<div ion-grid>
<div ion-row>
<div ion-col>col 1 div</div>
<div ion-col>col 2 div</div>
</div>
</div>
When I tried to put it as attributes, styles are not applied for grid, I get something similar to
col 1 div
col 2 div
expected result: col 1 div col 2 div
What am I doing wrong?
ref: http://ionicframework.com/docs/v2/api/components/grid/Grid/#grid-size
I run a linear regression code and generated a pmml. In my pmml code there are data types and regression table info. I have a pmml code like that
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<PMML version="4.2"
xmlns="http://www.dmg.org/PMML-4_2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<Application name="SAS(r)" version="9.4"/>
<Timestamp>2016-05-27 09:58:01</Timestamp>
</Header>
<DataDictionary numberOfFields="10">
<DataField name="Invoice" optype="continuous" dataType="double"/>
<DataField name="ZINT_Cylinders" optype="continuous" dataType="double"/>
<DataField name="ZINT_EngineSize" optype="continuous" dataType="double"/>
</DataDictionary>
<TransformationDictionary/>
<RegressionModel functionName="regression" targetFieldName="Invoice" normalizationMethod="none">
<MiningSchema>
<MiningField name="ZINT_Cylinders" usageType="active" optype="continuous"/>
<MiningField name="ZINT_EngineSize" usageType="active" optype="continuous"/>
</MiningSchema>
<Output>
<OutputField name="P_Invoice" displayName="Predicted: Invoice" optype="continuous" dataType="double" targetField="Invoice" feature="predictedValue"/>
</Output>
<Targets>
<Target field="Invoice" optype="continuous">
<TargetValue defaultValue="30014.700935"/>
</Target>
</Targets>
<LocalTransformations/>
<RegressionTable intercept="-4919.70174">
<NumericPredictor name="ZINT_Cylinders" coefficient="-0.007378626"/>
<NumericPredictor name="ZINT_EngineSize" coefficient="-0.147331595"/>
</RegressionTable>
</RegressionModel>
</PMML>
Before the regression step, I want to transform the my source data. For example I want to add these case when structure to my pmml. Is it possible to do this?
SELECT Invoice,
CASE
WHEN EngineSize < 2.9 THEN 20304.5142857143
WHEN EngineSize < 4.1 THEN 30378.8789808917
WHEN EngineSize >= 4.1 THEN 47119.9791666667
ELSE 30014.7009345794
END AS ZINT_EngineSize,
CASE
WHEN Cylinders < 4.5 THEN 18349.4452554745
WHEN Cylinders < 7 THEN 29472.3819095477
WHEN Cylinders >= 7 THEN 48558.847826087
ELSE 30014.7009345794
END AS ZINT_Cylinders
FROM MYSOURCE.MYTABLE;
You can use the Discretize transformation for the job:
<DerivedField name="ZINT_EngineSize" dataType="double" optype="continuous">
<Discretize field="EngineSize">
<DiscretizeBin binValue="20304.5142857143">
<!-- EngineSize < 2.9 -->
<Interval closure="openOpen" rightMargin="2.9"/>
</DiscretizeBin>
<DiscretizeBin binValue="30378.8789808917">
<!-- EngineSize >= 2.9 && EngineSize < 4.1 -->
<Interval closure="closedOpen" leftMargin="2.9" rightMargin="4.1"/>
</DiscretizeBin>
<DiscretizeBin binValue="47119.9791666667">
<!-- EngineSize >= 4.1 -->
<Interval closure="closedOpen" leftMargin="4.1"/>
</DiscretizeBin>
</Discretize>
</DerivedField>
You could build a parser for SAS script, and automate the generation and embedding of Discretize elements using the JPMML-Model library.
hi my question is pretty simple that how to parse XML that contain HTML tags like id, br, code, href, Anchor and many more. now i m using XMLReader to get dictonary but its fails to convert it due to tag. i m sure because i test it with simple XML without html tag.
here is sample XML
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
<document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 http://www.accessdata.fda.gov/spl/schema/spl.xsd">
<id root="fdd1fa5e-9dbf-4951-a8e9-33d06e05bdba"/>
<code code="34391-3" codeSystem="2.16.840.1.113883.6.1" displayName="HUMAN PRESCRIPTION DRUG LABEL"/>
<title>WELLBUTRIN XL<sup>®</sup>
<br/>(bupropion hydrochloride extended-release tablets)</title>
<effectiveTime value="20101201"/>
<setId root="fdd1fa5e-9dbf-4951-a8e9-33d06e05bdba"/>
<versionNumber value="1"/>
<author>
<time/>
<assignedEntity>
<representedOrganization>
<id extension="118802834" root="1.3.6.1.4.1.519.1"/>
<name>Rebel Distributors Corp</name>
<assignedEntity>
<assignedOrganization>
<assignedEntity>
<assignedOrganization>
<id extension="118802834" root="1.3.6.1.4.1.519.1"/>
<name>Rebel Distributors Corp</name>
</assignedOrganization>
<performance>
<actDefinition>
<code code="C73607" codeSystem="2.16.840.1.113883.3.26.1.1" displayName="RELABEL"/>
</actDefinition>
</performance>
<performance>
<actDefinition>
<code code="C73606" codeSystem="2.16.840.1.113883.3.26.1.1" displayName="REPACK"/>
</actDefinition>
</performance>
</assignedEntity>
</assignedOrganization>
</assignedEntity>
</representedOrganization>
</assignedEntity>
</author>
<component>
<section ID="i4i_pharmacokinetics_id_64f18136-4148-40b6-bdc1-5a836f89badf">
<id root="b72d6d1f-ba84-4360-b6d2-356e2659d444"/>
<code codeSystem="2.16.840.1.113883.6.1" code="43682-4" displayName="PHARMACOKINETICS SECTION"/>
<text>
<paragraph>
<content styleCode="bold">Pharmacokinetics: </content>Bupropion is a racemic mixture. The pharmacologic activity and pharmacokinetics of the individual enantiomers have not been studied. The mean elimination half-life (±SD) of bupropion after chronic dosing is 21 (±9) hours, and steady-state plasma concentrations of bupropion are reached within 8 days.</paragraph>
<paragraph>In a study comparing 14-day dosing with WELLBUTRIN XL 300 mg once daily to the immediate-release formulation of bupropion at 100 mg 3 times daily, equivalence was demonstrated for peak plasma concentration and area under the curve for bupropion and the 3 metabolites (hydroxybupropion, threohydrobupropion, and erythrohydrobupropion). Additionally, in a study comparing 14-day dosing with WELLBUTRIN XL 300 mg once daily to the sustained-release formulation of bupropion at 150 mg 2 times daily, equivalence was demonstrated for peak plasma concentration and area under the curve for bupropion and the 3 metabolites.</paragraph>
</text>
<effectiveTime value="20100602"/>
<component>
<section ID="i4i_section_id_6d40273a-9091-4892-8274-c5d63bfd5e3d">
<id root="49620c24-b19c-4e05-8d56-cf59a423a74a"/>
<code codeSystem="2.16.840.1.113883.6.1" code="42229-5" displayName="SPL UNCLASSIFIED SECTION"/>
<text>
<paragraph>
<content styleCode="bold">
<content styleCode="italics">Absorption: </content>
</content>Following oral administration of WELLBUTRIN XL to healthy volunteers, time to peak plasma concentrations for bupropion was approximately 5 hours and food did not affect the C<sub>max</sub> or AUC of bupropion. </paragraph>
</text>
<effectiveTime value="20100602"/>
</section>
</component>
<component>
Please help me out of this thanks in advance....