Forum Replies Created

AuthorPosts

avalaParticipant
Thanks, Alexander. This code, combined with some currency functions, works like a dream. The last hurdle is to run this function after the vLookup tables have loaded. I’m currently calling the function from an HTML button, but I’d like to automate this if possible.
For anyone in a similar situation:
fields = init_fields_v2(); function AggregateTotals() { //get Man hours var totalVDCMH= $(".vLookup_total_vLookupVDC:eq(13)").text(); var totalProposalMH= $(".vLookup_total_vLookupProposal:eq(11)").text(); var totalDesignMH= $(".vLookup_total_vLookupDesign:eq(17)").text(); //get cost var totalVDCCost= $(".vLookup_total_vLookupVDC:eq(14)").text(); var totalProposalCost= $(".vLookup_total_vLookupProposal:eq(12)").text(); var totalDesignCost= $(".vLookup_total_vLookupDesign:eq(18)").text(); //calculate totals var totalMH= (+totalVDCMH+ +totalProposalMH+ +totalDesignMH); var totalnewVDCCost = parseFloat(totalVDCCost.replace(/[^09.]/g, '')); var totalnewProposalCost = parseFloat(totalProposalCost.replace(/[^09.]/g, '')); var totalnewDesignCost = parseFloat(totalDesignCost.replace(/[^09.]/g, '')); var totalCost= (totalnewVDCCost +totalnewProposalCost +totalnewDesignCost ); function CurrencyFormatted(amount) { var i = parseFloat(amount); if(isNaN(i)) { i = 0.00; } var minus = ''; if(i < 0) { minus = ''; } i = Math.abs(i); i = parseInt((i + .005) * 100); i = i / 100; s = new String(i); if(s.indexOf('.') < 0) { s += '.00'; } if(s.indexOf('.') == (s.length  2)) { s += '0'; } s = minus + s; return s; } function CommaFormatted(amount) { var delimiter = ","; // replace comma if desired var a = amount.split('.',2) var d = a[1]; var i = parseInt(a[0]); if(isNaN(i)) { return ''; } var minus = ''; if(i < 0) { minus = ''; } i = Math.abs(i); var n = new String(i); var a = []; while(n.length > 3) { var nn = n.substr(n.length3); a.unshift(nn); n = n.substr(0,n.length3); } if(n.length > 0) { a.unshift(n); } n = a.join(delimiter); if(d.length < 1) { amount = n; } else { amount = n + '.' + d; } amount = minus + amount; return amount; } var result = CurrencyFormatted(totalCost); result = CommaFormatted(result); setFieldValue('TotalEstimatedMHs',totalMH); setFieldValue('TotalEstimatedCost',"$" +result); }
avalaParticipantThat fixed it. Thanks, as always, for your help and going above and beyond. You deserve a few barrels of beer!
avalaParticipantSorry I missed your reply. I have updated to the most current DFFS files and I do see improvement in the spacing between the vLookup headers and items.
Can you clarify what will and will not show up in the print out? Much of the HTML formatting in headers, horizontal lines, etcetera will show in the print preview but not in the actual printout or PDF.
You can compare the difference in the attachments below.
 This reply was modified 8 years, 5 months ago by avala.
Attachments:
February 23, 2016 at 15:19 in reply to: Load parent form with folders in "open" state on load #10403avalaParticipantThis is perfect! Thank you both!
avalaParticipantIs there a way to disable the invalid value response? We want to provide the convenience of type ahead to see if data has already been entered, but give them the opportunity to add new values to the list at the same time. Users love that autocomplete!
Attachments:
avalaParticipantWorks like a charm. Thank you!!!
January 25, 2016 at 17:16 in reply to: Delete "button" on child item with refresh for document library #9993avalaParticipantOn a similar note, when you delete a child item from the “popup” window it refreshes the parent item loosing any work you may have done. Would love to see this “fixed.”
avalaParticipantBingo!
The correct class was vLookup_total_vLookup and not the vLookup field “Line_x0020_Total”. THANK YOU for your help on this totally above and beyond!Final code:
fields = init_fields_v2(); function CalcTotal() { var vLookupTotal = $(".vLookup_total_vLookup").text(); setFieldValue('Subtotal',vLookupTotal); var Subtotal = getFieldValue('Subtotal'); var Tax = getFieldValue('Sales_x0020_Tax'); var Prod = ((vLookupTotal*Tax)/100); var TotalCalc = (+Prod + +vLookupTotal); setFieldValue('Total',TotalCalc); }
avalaParticipantI’ve updated all DFFS files to the January 03 Beta (v4.365 BETA 1).
Ran the following in the Dev Console: $(“.vLookup_Line_x0020_Total_vLookup”).text(); which returned, “”The function is run on the following rules:
Rule 1
If Subtotal
Is Changed
Validate on Form Load and field change
Run these functions: CalcTotalRule 2
If SalesTax
Is Changed
Validate on Form Load and field change
Run these functions: CalcTotalIt appears to be running just fine, it’s just returning an empty string. When I comment out the new subtotal var and setfield value the Total Calculations work perfectly.
 This reply was modified 8 years, 6 months ago by avala.
avalaParticipantAlexander,
The Subtotal field is still being cleared on function run. I’ve attempted the following:
1. Updated all DFFS files and plugins to December 14th, 2015 versions
2. Updated the following files to the January 03, 2016 BETA 1
DFFS_DirectToBackend.html
vLookup_ListView.html
vLookup_NewForm.html
SPJSvLookup_backend.js
SPJSvLookup_frontend.js
SPJSvLookup_receiver.js
SPJSutility.js
jquery.js
DFFS_backend_min.js
DFFS_frontend_min.jsThis is my code:
fields = init_fields_v2(); function CalcTotal() { var vLookupTotal = $(".vLookup_Line_x0020_Total_vLookup").text(); setFieldValue('Subtotal',vLookupTotal); //var Subtotal = getFieldValue('Subtotal'); //var Tax = getFieldValue('Sales_x0020_Tax'); //var Prod = ((Subtotal*Tax)/100); //var TotalCalc = (+Prod + +Subtotal); //var Subtotal = getFieldValue('Subtotal'); //setFieldValue('Total',TotalCalc); }
 This reply was modified 8 years, 6 months ago by avala.
avalaParticipantNo worries. I appreciate you taking the time to answer our little questions.
This is the code I’m currently using (I’ve commented out the rest until I can get the Subtotal working). I’ve grabbed the field internal name from the child list for Line Total (Line_x0020_Total) and used the field internal name for the vLookup (vLookup) field in the parent. Is this correct? When the function is triggered it empties the Subtotal field.
fields = init_fields_v2(); function CalcTotal() { var vLookupTotal = $(".vLookup_Line_x0020_Total_vLookup").text(); //var Subtotal = getFieldValue('Subtotal'); //var Tax = getFieldValue('Sales_x0020_Tax'); //var Prod = ((Subtotal*Tax)/100); //var TotalCalc = (+Prod + +Subtotal); setFieldValue('Subtotal',vLookupTotal); //setFieldValue('Total',TotalCalc); }
Attachments:
avalaParticipantSo issue number 3 was a metadata issue. vLookup was doing it’s job just fine!
avalaParticipantAs a quick follow up, this is the custom JS I’m using in the form. I’d like to populate the Subtotal field with the Sum from the Line Total Column in the vLookup attachment (see post attachment above).
fields = init_fields_v2(); function CalcTotal() { var Subtotal = getFieldValue('Subtotal'); var Tax = getFieldValue('Sales_x0020_Tax'); var Prod = ((Subtotal*Tax)/100); var TotalCalc = (+Prod + +Subtotal); setFieldValue('Total',TotalCalc); }
 This reply was modified 8 years, 7 months ago by avala.
avalaParticipantAlexander,
I’m in a similar situation where I’d like to do a calculation in the parent form from the _vLookup children totals. We have a few additional requests coming in the next month that will require a similar function. Is there a way to pull the TD.vLookupTotals while in the parent form or an alternate solution?
I’ve included an attachment for reference.
 This reply was modified 8 years, 7 months ago by avala.
Attachments:
avalaParticipantYou can ignore the previous post. The first dropdown and kill script work fine, but that dynamic component continues to elude me. We’ve tried using the CAML and filterValue with the fVal, but I think we’re just inserting the text fVal.
Current config for second dropdown (using what Alexander listed above):
spjs.lookup.init({ "fieldToConvertToDropdown":["Location"], "listName":"Task Forces", "listBaseUrl":"/Sites/XXXXXXX", "optTextFieldInternalName":"DefaultLocation", "sortFieldName":"DefaultLocation", "filterObj":{ "on":true, "folder":"", // Leave empty to search in all folders "CAML":"<Where><Eq><FieldRef Name='Title'/><Value Type='Text'>[currentItem:fVal]</Value></Eq></Where>", // If used, the rest of the filterObj settings are disregarded "fin":"Title", "isLookup":false, "operator":"Eq", "filterVal":"fVal", }, "dropDownDefaultvalue":"...", "addYouOwnValue":{ "on":true, "linkText":"Enter a temporary location" }, "addToExternalList":{ "on":false, "customFunction":null, // Function name as a string. If a function name is supplied, this will be used in stead of the default function. The function will be passed the argument object as a parameter. "linkText":"Add new item", "saveNewItemText":"Save new item" }, "debug":false });

AuthorPosts