0

I would like to create a sum formula based on yes/no fields...

Evening All, 

I work in construction and i am trying to build a quotation form that will allow me to add various sections as our projects vary quite a bit, i have created tabs which are only visbale when i select a tick box that relates to that section, i would now like a formula that sums up the section sub totals depending on the selection (i.e. only add the sub totals to section 1, 2 and 3, if 'Show S2' and 'Show S3' are selected). I would also like to have somthing similar this on print veiw, so only the selected sections are shown on the print view without leaving gaps. 

Please help, thank you.

16 replies

null
    • Terry_Prokopchuk
    • 4 yrs ago
    • Reported - view

    Can anyone help please, thank you.

    • Terry_Prokopchuk
    • 4 yrs ago
    • Reported - view

    This is what i have been trying to use to achive my function, as you can tell and am very new to this. 

     

    let S2 := 'Show S2' = 1;
    let S3 := 'Show S2' = 1 and 'Show S3' = 1;
    let S4 := 'Show S2' = 1 and 'Show S3' = 1 and 'Show S4' = 1;
    let S5 := 'Show S2' = 1 and 'Show S3' = 1 and 'Show S4' = 1 and 'Show S5';

    if S2 then
    sum('Section 1 NET Total:' + 'Section 2 NET Total:')

    else

    if S3 then
    sum('Section 1 NET Total:' + 'Section 2 NET Total:' + 'Section 3 NET Total:')

    else
    sum('Section 1 NET Total:')

    end
    end

    • Ninox partner
    • RoSoft_Steven.1
    • 4 yrs ago
    • Reported - view

    Terry,

    Maybe this can help?

     

    'Section 1 NET Total:' + if 'Show S2' then
    'Section 2 NET Total:' + if 'Show S3' then
    'Section 3 NET Total:' + if 'Show S4' then
    'Section 4 NET Total:'
    end
    end
    end

     

    Steven.

    • Terry_Prokopchuk
    • 4 yrs ago
    • Reported - view

    Thank you Steven, thats great works perfectly. 

    • Terry_Prokopchuk
    • 4 yrs ago
    • Reported - view

    Now i just need to figure out how to hide the sections in print view based on the same system.

    • Ninox partner
    • RoSoft_Steven.1
    • 4 yrs ago
    • Reported - view

    Can you be more specific and show what the tables look like in the different tabs. I think you can solve this by creating an extra staging table and use this one to print out. Or i make a small example to figure it out yourself if that's good.

    I 'll then try to make that example one in my spare time soon .

    Steven.

    • Ninox partner
    • RoSoft_Steven.1
    • 4 yrs ago
    • Reported - view
    • Terry_Prokopchuk
    • 4 yrs ago
    • Reported - view

    Hi Steven, 

    Sorry for the late reply, please see attached for example the print layout when i have information within sections 1, 2 and 3. the print layout is fine, however when i only have pricing information in section 1, the layout for sections 2 & 3 still apear on the print layout. 

    I would ideally like the layout to correspond with the selections i made with the check boxes as shown previously...

     

    Screenshot 2020-04-07 at 09.43.38Screenshot 2020-04-07 at 09.43.55Screenshot 2020-04-07 at 09.45.05Screenshot 2020-04-07 at 09.45.11Screenshot 2020-04-07 at 09.45.19

    • Terry_Prokopchuk
    • 4 yrs ago
    • Reported - view

    Hi Steven, 

     

    i have set up some print templates and named them 'Quotation - 1 Section', Quatation - 2 Sections'.....etc. I am trying to use the follwing formula on a button, but it doesnt seem to be working. Any suggestions?

    let S2 := 'Show S2' = 1;
    let S3 := 'Show S2' = 1 and 'Show S3' = 1;
    let S4 := 'Show S2' = 1 and 'Show S3' = 1 and 'Show S4' = 1;
    let result := dialog("Sending Your Quotation...", "You are sending this quotation to : " + 'Client Contact'.'First Name' + " " + 'Client Contact'.Surname + " of " + Client.'Client Name' + " at the following address (" + 'Client Contact'.'Email Address' + " ), do you wish to send it?", ["Send", "Cancel"]);
    let myEmail := userEmail();
    let myPdf1 := printAndSaveRecord(this, "Quotation - 1 Section");
    let myPdf2 := printAndSaveRecord(this, "Quotation - 2 Sections");
    let myPdf3 := printAndSaveRecord(this, "Quotation - 3 Sections");
    let myName := "Tritec Quotation " + 'Quotation No' + " - " + Project.'Project Reference' + ".pdf";
    if S2 and result = "Send" then
    importFile(this, myPdf2, myName);
    sendEmail({
    from: myEmail,
    to: 'Client Contact'.'Email Address',
    subject: "Tritec Quotation No." + 'Quotation No' + " - " + Project.'Project Title',
    text: 'Email Text',
    html: 'Email text HTML',
    attachments: file(this, myName)
    }) + alert("Quotation Sent to " + 'Client Contact'.'Email Address')
    else
    if S3 and result = "Send" then
    importFile(this, myPdf3, myName);
    sendEmail({
    from: myEmail,
    to: 'Client Contact'.'Email Address',
    subject: "Tritec Quotation No." + 'Quotation No' + " - " + Project.'Project Title',
    text: 'Email Text',
    html: 'Email text HTML',
    attachments: file(this, myName)
    }) + alert("Quotation Sent to " + 'Client Contact'.'Email Address')
    else
    if result = "Send" then
    importFile(this, myPdf1, myName);
    sendEmail({
    from: myEmail,
    to: 'Client Contact'.'Email Address',
    subject: "Tritec Quotation No." + 'Quotation No' + " - " + Project.'Project Title',
    text: 'Email Text',
    html: 'Email text HTML',
    attachments: file(this, myName)
    }) + alert("Quotation Sent to " + 'Client Contact'.'Email Address')
    end
    end
    end

    Screenshot 2020-04-07 at 15.10.46Screenshot 2020-04-07 at 15.11.09Screenshot 2020-04-07 at 15.11.18

    • Ninox partner
    • RoSoft_Steven.1
    • 4 yrs ago
    • Reported - view

    Maybe this code will help a little:

    let s2 := if 'Show S2' then "1" else "0" end;
    let s3 := if 'Show S3' then "1" else "0" end;
    let s4 := if 'Show S4' then "1" else "0" end;
    let x := s2 + s3 + s4;
    let p := if x = "100" then
    "2Sections"
    else
    if x = "110" then
    "3Sections"
    else
    if x = "111" then "4Sections" else "1Section" end
    end
    end;
    Printlayout := p

    You can change the printlayoutnames to yours in the rest of your code.

    if result = "Send" then
    importFile(this, printAndSaveRecord(this, Printlayout), myName);
    sendEmail({
    from: myEmail,
    to: 'Client Contact'.'Email Address',
    subject: "Tritec Quotation No." + 'Quotation No' + " - " + Project.'Project Title',
    text: 'Email Text',
    html: 'Email text HTML',
    attachments: file(this, myName)
    }) + alert("Quotation Sent to " + 'Client Contact'.'Email Address')

    end

    (The code can be shorten as you can see)

    Not shure what the first 3 lines in your code do but i think they are not necessary.

    Hope the above does help you a little understanding what i mean.

    Steven

    • Terry_Prokopchuk
    • 4 yrs ago
    • Reported - view

    Any ideas, kind folks!

    • Terry_Prokopchuk
    • 4 yrs ago
    • Reported - view

    Sorry Steven this literally just appeared!

    • Terry_Prokopchuk
    • 4 yrs ago
    • Reported - view

    Hi Steven, 

     

    it works when i apply the code to just saving it as an attachement and it seems to follow through with the alerts to say it sent, but it doesnt seem that the emails are being sent.

    • Ninox partner
    • RoSoft_Steven.1
    • 4 yrs ago
    • Reported - view

    Do you have a cloud subscription? This is needed for sending emails within Ninox.

    And the line

    Printlayout := p

    Should be

    let Printlayout := p

     

    And also i think the line in your code :

    attachments: file(this, myName)

    should be (i think, please try)

    attachments: first(files(this))

    Steven.

    • Terry_Prokopchuk
    • 4 yrs ago
    • Reported - view

    yeah, literally upgraded on the 7th for upto 10 users. I'll try that?

    • Terry_Prokopchuk
    • 4 yrs ago
    • Reported - view

    Think may be somthing to do with the cloud settings as nothing is coming through :(

Content aside

  • 4 yrs agoLast active
  • 16Replies
  • 1816Views