how to toggle two codes with one button

Discussion in 'Tally Developer' started by HAROON2015, Oct 3, 2019.

    
  1. HAROON2015

    HAROON2015 Member


    hi,
    i am using two buttons to run these two codes
    1st code is
    Code:
    [#Report    : Item Monthly Summary]
        Variable : vGreaterAmountss
        Local    : Form : Default : Add : Button : Previous Months
    [Variable : vGreaterAmountss]
        Type  : Logical
    [Button         : Previous Months]
        Key         : F8
    action :Call:setreportdatess
    [Function:setreportdatess]
        01:Set      : SVFromDate          : $$MonthStart:$$PrevMonth:##SVCurrentDate
        02:Set      : SVToDate            :$$MonthEnd:$$PrevMonth:##SVCurrentDate
        03:Return
    and 2nd code is
    Code:
    [#Report    : Item Monthly Summary]
        Variable : vdDGreaterAmounts
        Local    : Form : Default : Add : Button : Current MonthS
    [Variable : vdDGreaterAmounts]
        Type  : Logical
    [Button         : Current MonthS]
        Key         : F9
    action :Call:AsetreportdatesA
    [Function:AsetreportdatesA]
        01:Set      : SVFromDate          : $$MonthStart:##SVCurrentDate
        02:Set      : SVToDate            : $$MonthEnd:##SVCurrentDate
    i want to toggle them with one button,

    hope some one will help
     


  2. teja varma

    teja varma Active Member


    use variable to save the state of button and based on that set those variables as you need.
     


  3. HAROON2015

    HAROON2015 Member


    tried many time,
    will you please explain more
    Code:
    [#Report    : Purchase Register]
        Variable : vGreaterAmounty 
        Local    : Form : Default : Add : Button : SzhowOnly
       
    [Button         : SzhowOnly]
        Key         : alt + F8
        Action     : call : if ##vGreaterAmounty= "setreportdatesx" then "setreportdatesAx" else "setreportdatesx"
    [Variable : vGreaterAmounty]
    Type  : Logical
    [Function:setreportdatesAx]
        01:Set      : SVFromDate          : $$MonthStart:##SVCurrentDate
        02:Set      : SVToDate            : $$MonthEnd:##SVCurrentDate
    [Function:setreportdatesx]
        01:Set      : SVFromDate          : $$MonthStart:$$PrevMonth:##SVCurrentDate
        02:Set      : SVToDate            :$$MonthEnd:$$PrevMonth:##SVCurrentDate
    
    thanks for the reply
     
    Last edited: Oct 5, 2019


  4. HAROON2015

    HAROON2015 Member


    its setting the previous month but not toggling the current month

    hope you will help
     


  5. HAROON2015

    HAROON2015 Member


    Help please
     


  6. Jay kumar tailor

    Jay kumar tailor Well-Known Member


    Action List : Button 1, Button 2
     


  7. HAROON2015

    HAROON2015 Member


    thanks for the reply
    tried in this way, i thing i am still wrong
    Code:
    [#Report    : Item Monthly Summary]
    
    
    [#Report    : Item Monthly Summary]
        Variable : vdDGreaterAmounts
        Local    : Form : Default : Add : Button : Current MonthS
    Local    : Form : Default : Add : Button : CurrentzMonthS
        Local    : Form : Default : Add : Button : Previous Months
    [Variable : vdDGreaterAmounts]
        Type  : Logical
    [Button         : Current MonthS]
        Key         : F9
    action :Call:AsetreportdatesA
    [Function:AsetreportdatesA]
        01:Set      : SVFromDate          : $$MonthStart:##SVCurrentDate
        02:Set      : SVToDate            : $$MonthEnd:##SVCurrentDate
    
    
    [Button         : Previous Months]
        Key         : F8
    action :Call:setreportdatess
    [Function:setreportdatess]
        01:Set      : SVFromDate          : $$MonthStart:$$PrevMonth:##SVCurrentDate
        02:Set      : SVToDate            :$$MonthEnd:$$PrevMonth:##SVCurrentDate
        03:Return
    
    
    [Button         : CurrentzMonthS]
        Key         : alt + F9
    action list : Previous Months, Current MonthS
     


  8. HAROON2015

    HAROON2015 Member


    Help please
     


  9. HAROON2015

    HAROON2015 Member


    anybody please help
     


  10. Jay kumar tailor

    Jay kumar tailor Well-Known Member


    use + or - symbols in monthly reports
     


  11. Ria

    Ria Member


    Code:
      
    [#Report    : Item Monthly Summary]
      
        Variable : vdDGreaterAmounts
        Local    : Form : Default : Add : Button : MonthToggle
        ;Local    : Form : Default : Add : Button : CurrentzMonthS
        ;Local    : Form : Default : Add : Button : Previous Months
      
    [Variable : vdDGreaterAmounts]
      
        Type  : Logical
      
    [Variable : SetReportDate]
      
        Type    : Logical
      
    [System    : Variable]
      
        SetReportDate
      
    [Button         : MonthToggle]
    
        Key         : F9
        Title        : If NOT ##SetReportDate Then "Current Month" else "Previous Month"
        action         : Call : AsetreportdatesA
      
    [Function : AsetreportdatesA]
      
        01    : Set       : SetReportDate         : NOT ##SetReportDate
      
        02  : If : ##SetReportDate
        03    :     Set : SVFromDate          : $$MonthStart:##SVCurrentDate
        04    :     Set : SVToDate            : $$MonthEnd:##SVCurrentDate
        05    : Else    
        06  :    Set    :  SVFromDate              : $$MonthStart:$$PrevMonth:##SVCurrentDate
        07    :    Set :  SVToDate                : $$MonthEnd:$$PrevMonth:##SVCurrentDate
        08    : EndIf
     
    HAROON2015 likes this.


  12. HAROON2015

    HAROON2015 Member


    Once Again Thank you very much
     


Share This Page