Open n Close

Discussion in 'Free Source Codes' started by Neeru, May 4, 2020.

    
  1. panam

    panam Member


    This code done for changing stock item rate in bulk using trigger key with counter and increment function.
    just experimented for learning purpose...

    i posted the code here to help the beginners like me...
     


  2. panam

    panam Member


    dear sir,
    how to repeat trigger function key by date wise. i tried but tally is hanging..

    Variable : SVFromDate,SVToDate
    01:Set : SVFromDate : $$MonthStart:##SVCurrentDate
    02:Set : SVToDate : $$MonthEnd:##SVCurrentDate
    03: WHILE : $$MonthStart:##SVCurrentDate<=$$MonthEnd:##SVCurrentDate
    04: Trigger key :enter,enter,enter, f3, down, down, ctrl+A, down
    ;;04: INCREMENT : Counter
    05: End While
    06: Return
     


  3. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Your condition at 03 is always going to be TRUE........ so it is infinite loop.

    Please do understand properly the words and syntax used, before using them....... it is self explanatory.
     
    panam likes this.


  4. panam

    panam Member


    p
    sir.please guide or give hint how to stop the infinite loop.
     


  5. Himanshu-2002

    Himanshu-2002 Active Member


    [Function: Trigger]
    Variable Counter: Number
    Variable Counter2:Number
    00:Set: Counter2:$$Number:($$Date: (#SvFromDate - #SvToDate))
    01: Log: ##Counter
    02: While: ##Counter<##Counter2
    03: Trigger Key: Enter, Ctrl + A, Down
    04: Increment:##Counter
    05: End While


    I am not very sure this will work or Not Because I didn't tested it....So, Please check the same and try to understand what you are writing
     
    panam likes this.


  6. Himanshu-2002

    Himanshu-2002 Active Member


    And There is no solution to stop infinite loop because Suppose If I tell that Write Until 1=1 So, How you will stop this loop..... Mathematically it is not possible
     
    panam likes this.


  7. panam

    panam Member


    bro thank u for valuable reply and help.
    But code still not working.
    trigger function not working. its just idle.
     
    Last edited: Nov 9, 2020


  8. panam

    panam Member


    In this code, trigger key function is working but infinite loop is happenning...

    [FUNCTION:trigger]
    Variable : Counter : Number

    01: Log :counter :#SvFromDate
    02: While : ##counter< #SvToDate
    03: Trigger key :enter,enter,enter, f3, down, down, ctrl+A, down
    04: INCREMENT : Counter
    05: End While
    06: Return
     


  9. Himanshu-2002

    Himanshu-2002 Active Member


    Sir Modify the Trigger Keys According to your requirements because I think Logic is perfect
     


  10. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Why are you making a DATE as a counter.........???

    In Excel type today's date and then convert it to a number in another cell......... that is the number a DATEVALUE holds...........
    Also in Tally -- date is not a number...........
     
    panam likes this.


  11. Himanshu-2002

    Himanshu-2002 Active Member


    In Your Code You are comparing date and Number So, I don't think It will work because The data type has to be same
     


  12. panam

    panam Member


    dear Amit sir and Himanshu bro,
    Thank u for the reply.
    now forget the last topic.
    now i am changing my query by different method. kindly guide me
    now i want to use trigger function to accept the voucher by date wise.
    example if i have 20 sales vouchers dated 01-11-2020, i have to use trigger function for this date only(01-11-2020) . how to do..
    please give hint and guide me.
     


  13. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    You must try to understand the LOGIC...........

    You have 20 sales voucher...... assume you made a condition and triggered for sales vouchers of that date.......... then what...........

    Those 20 sales voucher still has the same date.......... so your function will go on and on and on and on..............
     
    panam likes this.


  14. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Do not understand what your objectives is..........

    So learn this........
    When you make a function based on some conditional value.......e.g. as per you......all 20 sales vouchers of 01-11-2020 ..... so when you run your function, the conditions needs to be changed........like date change from 1st to 2nd or whatever, else you will just go round and round with no exit.

    Or as you tried earlier...have a COUNTER ---10 times, 20 times and so on............. here in this case it will EXIT after your counter is finished.
     
    panam likes this.


  15. panam

    panam Member


    Dear sir, can i end the loop by selection(selected vouchers)
    Example
    As per earlier reply, there are 20 vouchers in 1 -11-20 date, I want to end the function after the 20 th voucher.
    So my question is that I have selected the 20 vouchers. will the loop end by selection.
     


  16. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Yes you can............make a collection of selected voucher and pass it on to your function...........

    But again the condition within your function is of date ......... if the date is 01-11-2020 ........... so even after you run your function it will still go on and on and on........

    ;)
     
    panam likes this.


  17. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    In simple terms.... think it this way.......if you want to call your friend......and you know his number starts from 98887_____ ...last 5 numbers you do not have....

    So will you try to find his number or will you go through all possible digits from 00000 to 99999 ????

    In this same manner you have to apply logic and structure your code accordingly.
     
    Last edited: Nov 10, 2020
    panam likes this.


  18. SUSHIL SHARMA

    SUSHIL SHARMA Member


    O
    okk sir mujhe pata nhi tha sir me bhi bigenner hi hu mene kiya to koi fark nhi pada to mene puch liya
     
    panam likes this.


  19. sivam

    sivam Active Member


    Use While and you can Repeat N Number of Times...
     
    panam likes this.


  20. panam

    panam Member


    Thank u Sivam ji for the reply and help.
     


Share This Page