var noMDETGroup1 = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup();
noMDETGroup1.MDEntryType = new MDEntryType('0');
var noMDETGroup2 = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup();
noMDETGroup2.MDEntryType = new MDEntryType('1');
var noMDETGroup3 = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup();
noMDETGroup3.MDEntryType = new MDEntryType('2');
var noMDETGroup4 = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup();
noMDETGroup4.MDEntryType = new MDEntryType('4');
msg.AddGroup(noMDETGroup1);
msg.AddGroup(noMDETGroup2);
msg.AddGroup(noMDETGroup3);
msg.AddGroup(noMDETGroup4);
}
Is there any simpler way to do the repeating group? The Quick Fix/n site give me this idea: http://quickfixn.org/tutorial/repeating-groups.html
Well, here's one way:
char[] mdEntryTypes = {'0', '1', '2', '4'};
foreach (char c in mdEntryTypes)
{
var group = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup();
group.MDEntryType = new MDEntryType(c);
msg.AddGroup(group);
}
Related
I'm developing a word addin that pulls xml data from our servers and binds it to a rich text content control. The user should only be able to format the data within the content control but can't edit or delete the data.
This is the code i've been able to come up with but it's not working..
var ooxmlPackage = new DOMParser().parseFromString(
'<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage"></pkg:package>',
"text/xml"
);
var ooxmlPart = ooxmlPackage.createElement("pkg:part");
ooxmlPart.setAttribute("pkg:name", "/_rels/.rels");
ooxmlPart.setAttribute("pkg:contentType", "application/vnd.openxmlformats-package.relationships+xml");
ooxmlPart.setAttribute("pkg:padding", "512");
var ooxmlxmlData = ooxmlPackage.createElement("pkg:xmlData");
var ooxmlRelationships = ooxmlPackage.createElement("Relationships");
ooxmlRelationships.setAttribute("xmlns", "http://schemas.openxmlformats.org/package/2006/relationships");
var ooxmlRelationship = ooxmlPackage.createElement("Relationship");
ooxmlRelationship.setAttribute("Id", "rId1"); //TODO: generate unique ID
ooxmlRelationship.setAttribute(
"Type",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
);
ooxmlRelationship.setAttribute("Target", "word/document.xml");
ooxmlRelationships.appendChild(ooxmlRelationship);
ooxmlxmlData.appendChild(ooxmlRelationships);
ooxmlPart.appendChild(ooxmlxmlData);
var ooxmlDocPart = ooxmlPackage.createElement("pkg:part");
ooxmlDocPart.setAttribute("pkg:name", "/word/document.xml");
ooxmlDocPart.setAttribute(
"pkg:contentType",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"
);
var ooxmlDocPartxmlData = ooxmlPackage.createElement("pkg:xmlData");
var ooxmlDocument = ooxmlPackage.createElement("w:document");
ooxmlDocument.setAttribute("xmlns:w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
ooxmlDocument.setAttribute("xmlns:w15", "http://schemas.microsoft.com/office/word/2012/wordml");
var ooxmlDocumentBody = ooxmlPackage.createElement("w:body");
var ooxmlDocumentParagraph1 = ooxmlPackage.createElement("w:p");
var ooxmlContentControl = ooxmlPackage.createElement("w:sdt");
var sdtPr = ooxmlPackage.createElement("w:sdtPr");
//var lk = ooxmlPackage.createElement("w:lock");
//lk.setAttribute("w:val", "sdtContentLocked");
//sdtPr.appendChild(lk);
var alias = ooxmlPackage.createElement("w:alias");
alias.setAttribute("w:val", "MyControl");
sdtPr.appendChild(alias);
var id1 = ooxmlPackage.createElement("w:id");
id1.setAttribute("w:val", "1382295294");
sdtPr.appendChild(id1);
//var appr = ooxmlPackage.createElement("w15:appearance");
//appr.setAttribute("w15:val", "hidden");
//sdtPr.appendChild(appr);
sdtPr.appendChild(ooxmlPackage.createElement("w:showingPlcHdr"));
//var plchdlr = ooxmlPackage.createElement("w:placeholder");
//var docPrt = ooxmlPackage.createElement("docPart");
//docPrt.setAttribute("w:val", "defaultPlaceHolder_-1854013440");
//plchdlr.appendChild(docPrt);
//sdtPr.appendChild(plchdlr);
var bindingNode = ooxmlPackage.createElement("w15:dataBinding");
//bindingNode.setAttribute("w:prefixMappings","xmlns:ns0='custom'");
bindingNode.setAttribute("w:xpath","/Root[1]/Node[1]");
bindingNode.setAttribute("w:storeItemID", "{C2F77B86-6131-4922-803B-54FACB654C16}");
sdtPr.appendChild(bindingNode);
ooxmlContentControl.appendChild(sdtPr);
var sdtContent = ooxmlPackage.createElement("w:sdtContent");
var parag = ooxmlPackage.createElement("w:p");
var r = ooxmlPackage.createElement("w:r")
var t = ooxmlPackage.createElement("w:t")
//t.innerHTML= '[This is a test]';
r.appendChild(t);
parag.appendChild(r);
sdtContent.appendChild(parag);
ooxmlContentControl.appendChild(sdtContent);
ooxmlDocumentBody.appendChild(ooxmlDocumentParagraph1);
ooxmlDocumentBody.appendChild(ooxmlContentControl);
ooxmlDocument.appendChild(ooxmlDocumentBody);
ooxmlDocPartxmlData.appendChild(ooxmlDocument);
ooxmlDocPart.appendChild(ooxmlDocPartxmlData);
ooxmlPackage.documentElement.appendChild(ooxmlPart);
ooxmlPackage.documentElement.appendChild(ooxmlDocPart);
var serializer = new XMLSerializer();
var ooxmlPackageString = serializer.serializeToString(ooxmlPackage);
console.log(ooxmlPackageString);
Office.context.document.setSelectedDataAsync(ooxmlPackageString, { coercionType: "ooxml" });
Office.context.document.customXmlParts.getByIdAsync(
'<Root xmlns=""> <Node>VALUE1</Node></root>',
function (result) { });
It just inserts an empty content control when it runs, it doesn't map the xml node data as expected.
function ifstatement() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const ws = ss.getSheetByName("Product Form");
const ws2 = ss.getSheetByName("Email details");
var Avals = ws.getRange("c1:c").getValues();
var lr = Avals.filter(String).length;
Logger.log(lr);
var recipient = ws.getRange(lr,2).getValue();
var sub = ws.getRange(lr,4).getValue();
var mailTemp = ws.getRange(lr,5).getValue();
var impfield1 = ws.getRange(lr,6).getValue();
var impfield2 = ws.getRange(lr,8).getValue();
var impfield3 = ws.getRange(lr,10).getValue();
var fieldvalue1 = ws.getRange(lr,7).getValue();
var fieldvalue2 = ws.getRange(lr,9).getValue();
var fieldvalue3 = ws.getRange(lr,11).getValue();
var heading = ws.getRange(lr,12).getValue();
var subheading = ws.getRange(lr,13).getValue();
var body = ws.getRange(lr,14).getValue();
var footer = ws.getRange(lr,15).getValue();
var attach = ws.getRange(lr,17).getValue();
var tomail = ws.getRange(lr,16).getValue();
var file1 = attach.split(",").map(url => DriveApp.getFileById(url.trim().split("=")[1]).getBlob());
var AvalsWealth = ws2.getRange("b1:b").getValues();
var AvalsInsurance = ws2.getRange("c1:c").getValues();
var AvalsTeam = ws2.getRange("e1:e").getValues();
var lrWealth = AvalsWealth.filter(String).length;
var lrInsurance = AvalsInsurance.filter(String).length;
var lrTeam = AvalsTeam.filter(String).length;
Logger.log(mailTemp);
Logger.log(heading);
if(tomail=="Wealth RMs"){
var bccmail = ws2.getRange(2,2,lrWealth).getValues().toString();
} else if(tomail=="Self"){
var bccmail = recipient;
} else if(tomail=="Insurance RMs"){
var bccmail = ws2.getRange(2,3,lrInsurance).getValues().toString();
} else if(tomail=="All India"){
var bccmail = ws2.getRange(2,4,lrTeam).getValues().toString();
}
Logger.log(bccmail)
if(mailTemp=="HTML1"){
const htmlTemplate = HtmlService.createTemplateFromFile("HTML1");
htmlTemplate.heading = heading;
htmlTemplate.subheading = subheading;
htmlTemplate.body = body;
htmlTemplate.footer = footer;
htmlTemplate.impfield1 = impfield1;
htmlTemplate.impfield2 = impfield2;
htmlTemplate.impfield3 = impfield3;
htmlTemplate.fieldvalue1 = fieldvalue1;
htmlTemplate.fieldvalue2 = fieldvalue2;
htmlTemplate.fieldvalue3 = fieldvalue3;
const htmlforemail = htmlTemplate.evaluate().getContent();
GmailApp.sendEmail('',
""+ sub + "",
'',
{htmlBody: htmlforemail,
bcc: bccmail,
attachments: file1}
) } else if(mailTemp=="HTML2"){
const htmlTemplate = HtmlService.createTemplateFromFile("HTML2");
htmlTemplate.heading = heading;
htmlTemplate.subheading = subheading;
htmlTemplate.body = body;
htmlTemplate.footer = footer;
htmlTemplate.impfield1 = impfield1;
htmlTemplate.impfield2 = impfield2;
htmlTemplate.impfield3 = impfield3;
htmlTemplate.fieldvalue1 = fieldvalue1;
htmlTemplate.fieldvalue2 = fieldvalue2;
htmlTemplate.fieldvalue3 = fieldvalue3;
const htmlforemail = htmlTemplate.evaluate().getContent();
GmailApp.sendEmail('',
""+ sub + "",
'',
{htmlBody: htmlforemail,
bcc: bccmail,
attachments: file1}
) } else if(mailTemp=="HTML3"){
const htmlTemplate = HtmlService.createTemplateFromFile("AUM Annual awards");
htmlTemplate.heading = heading;
htmlTemplate.subheading = subheading;
htmlTemplate.body = body;
htmlTemplate.footer = footer;
htmlTemplate.impfield1 = impfield1;
htmlTemplate.impfield2 = impfield2;
htmlTemplate.impfield3 = impfield3;
htmlTemplate.fieldvalue1 = fieldvalue1;
htmlTemplate.fieldvalue2 = fieldvalue2;
htmlTemplate.fieldvalue3 = fieldvalue3;
const htmlforemail = htmlTemplate.evaluate().getContent();
GmailApp.sendEmail('',
""+ sub + "",
'',
{htmlBody: htmlforemail,
bcc: bccmail}
) } else if(mailTemp=="HTML4"){
const htmlTemplate = HtmlService.createTemplateFromFile("HTML4");
htmlTemplate.heading = heading;
htmlTemplate.subheading = subheading;
htmlTemplate.body = body;
htmlTemplate.footer = footer;
htmlTemplate.impfield1 = impfield1;
htmlTemplate.impfield2 = impfield2;
htmlTemplate.impfield3 = impfield3;
htmlTemplate.fieldvalue1 = fieldvalue1;
htmlTemplate.fieldvalue2 = fieldvalue2;
htmlTemplate.fieldvalue3 = fieldvalue3;
const htmlforemail = htmlTemplate.evaluate().getContent();
GmailApp.sendEmail('mayank.agarwal#aumcap.com',
""+ sub + "",
'',
{htmlBody: htmlforemail,
bcc: bccmail,
attachments: file1}
) }
}
I have this small setup where I have a Google Sheet, Google Appscript and Google form.
The user needs to input data in a Google Form - and once the sheet (linked with Form response) receives the updated row - a script is triggered which takes the data from the row and feeds it into the sheet and sends mail to the selected set of users.
Now the problem I am facing is that I need to send this mail to approx 100-150 people, however Googel appscript does not allow me to send mail to more than 30 participants at a time.
I understand that I need an Email service for this, however, I am unable to find any good solution wherein I can store my templates and the user just fills up data fields and shoots the mail.
Maybe because I am very new to this tech field so thats why.
Can anyone please guide me as to what is the setup I need to use for my purpose?
Thanks!
The first thing you need to do is to keep the BCC list as an array until it's necessary. This will allow us to make chunks out of it. This means removing the .toString() at the end of assigning bccmail.
Then, we need a custom function to send the email in batches of emails. I'm calling that function sendMassEmail.
function sendMassEmail(bccList, subject, plainBody, htmlBody, attachments) {
for (let bcc of chunks(bccList, 30)) {
GmailApp.sendEmail(
'',
subject,
plainBody,
{
htmlBody,
bcc: bcc.join(','),
attachments,
},
)
}
}
Chunks is a function that does exactly that, gets the elements of an array in chunks. My favorite implementation for this case is by using a generator.
I've kept the plain text body as it's important to generate it if you are sending it, as it is shown in most clients on the Inbox. Also, some of them can only read this ones (think smart watch).
The last argument (attachments) is optional.
Here is an example on how you would use it:
sendMassEmail(
bccmail,
sub.toString(),
'', // Should probably change it
htmlforemail,
file1,
)
Note that it's better to use toString() than concatenating into an empty string.
References
GmailApp.sendEmail(recipient, subject, body, options) (Apps Script reference)
for..of (MDN JavaScript reference)
Functions (MDN JavaScript guide)
Split array into chunks (StackOverflow question)
AND Filter is not working.
Filter is applied on both selected date and selected value from Combo box.
var oVal=this.getView().byId("idUser").getValue();
var dDateStart = oEvent.getSource().getProperty('dateValue');
var dDateEnd = new Date(dDateStart + 1);
var isValidDate = oEvent.getParameter("valid");
var aFilters = [];
dDateStart.setMilliseconds(0);
dDateStart.setSeconds(0);
dDateStart.setMinutes(0);
dDateStart.setHours(0);
dDateEnd.setMilliseconds(0);
dDateEnd.setSeconds(59);
dDateEnd.setMinutes(59);
dDateEnd.setHours(23);
aFilters=[new sap.ui.model.Filter("CreatedBy",sap.ui.model.FilterOperator.EQ, oVal),
new sap.ui.model.Filter("CrDate", sap.ui.model.FilterOperator.BT, dDateStart, dDateEnd)];
var oFilter = new sap.ui.model.Filter({
filters: aFilters,
and: true });
this.getView().byId("idCoTable").getBinding("items").filter(oFilter,true);
It is resolved.
Issue is with filtering with value instead of Key.
Thanks
I'm trying to generate a simple XLSX file using OpenXML but I'm getting an error when I open my file and the only info in the repairedRecord part of the log file is this:
Repaired Records: Cell information from /xl/worksheets/sheet1.xml part
The strange thing is that all the cells I'm trying to write do have the value I expect them to have. I'm just trying to write a single header row right now, where the headers is just an IEnumerable<string>:
using (var doc = SpreadsheetDocument.Create(filename, SpreadsheetDocumentType.Workbook)) {
var workbookPart = doc.AddWorkbookPart();
workbookPart.Workbook = new Workbook();
var worksheetPart = workbookPart.AddNewPart<WorksheetPart>();
worksheetPart.Worksheet = new Worksheet();
var sheets = workbookPart.Workbook.AppendChild(new Sheets());
var sheet = new Sheet {
Id = workbookPart.GetIdOfPart(worksheetPart),
SheetId = 1,
Name = "Sheet 1"
};
sheets.Append(sheet);
workbookPart.Workbook.Save();
var sheetData = worksheetPart.Worksheet.AppendChild(new SheetData());
var row = new Row { RowIndex = 1 };
var column = 1;
foreach (var header in headers)
row.AppendChild(new Cell {
CellReference = GetColumnLetter(column++) + "1",
DataType = CellValues.SharedString,
CellValue = new CellValue(header)
});
sheetData.Append(row);
workbookPart.Workbook.Save();
}
If you're inserting a string value, you should be using CellValues.InlineString
foreach (var header in headers)
row.AppendChild(new Cell (new InlineString(new Text(header))) {
CellReference = GetColumnLetter(column++) + "1",
DataType = CellValues.InlineString
});
i have this code in homepage
CheckBox[] ch= new CheckBox[12];
ch[0] = ChkContextA;
ch[1]= ChkContextB;
ch[2]= ChkContextC;
ch[3]= ChkContextD;
ch[4]= ChkContextE;
ch[5]= ChkContextF;
ch[6]= ChkContextG;
ch[7]= ChkContextH;
ch[8]= ChkContextI;
ch[9]= ChkContextJ;
ch[10]= ChkContextK;
ch[11]= ChiContextL;
for (int i = 0; i < 11; i++)
if (ch[i].Checked) search += ch[i].Text + " ";
Response.Redirect("SearchEstate.aspx?content="+search);
and this code in SearchEstate
var content = Request.QueryString["content"];
RealEstateEntities db = new RealEstateEntities();
var query = from O in db.Owners
join E in db.Estates on O.OwnerID equals E.OwnerID
join P in db.Properties on E.PropertyID equals P.PropertyID
where P.Facilities.Contains(content)
select new
{
regdate = E.RegisterDate,
region = E.Region,
Estype = E.EstateType,
Fac = P.Facilities,
deal = P.DealType,
price = P.TotalCost,
img = E.Picture,
addrss = O.Address,
area = P.Area,
tel = P.TellNum,
bed = P.RoomNum,
park = P.ParikingNum
};
Repeater2.DataSource = query.OrderByDescending(x => x.regdate);
Repeater2.DataBind();
when user checked some checkbox "content" for example have this value:
SearchEstate.aspx?content=ContextB ContextE ContextJ
I Want search this values in Facility field in db
How can I do this? (Sorry for my bad English)
I have the feeling your are looking for something along the lines of this query:
var content = Request.QueryString["content"];
string[] contentArray = content.Split(' ');
//...
var query = //...
where P.Facilities.Any(f => contentArray.Contains(f.FacilityName))
//...
(or instead of FacilityName some other property of Facility)
But I am not sure.