Announcement

Collapse
No announcement yet.

two questions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • two questions

    Hi Folks,
    Two questions ....

    1) I'd like certain things to happen similiar to if(isLastBarOnChart()) but instead "if is this week" or " since this past sunday " (meaning this past week only). Any ideas ?

    2) Somewhere in this vast forum of information i believe I read about a thread explaining all the rules and tips and tricks about writing out a tab delimeted file ... spacings etc. I've not been able to find it .. if anyone has any thoughts as to where it might be, please let me know.

    Chris

  • #2
    Re: two questions

    Hi Chris,

    Regarding your first question, you should be able to construct a conditional that does this with date methods associated with bar times as compared to the methods associated with the JavaScript Date Object.

    As for your second question, try the following search term chris* AND tab* AND *file* and put my User Name in the 'Search By User Name' box. I believe that will get you to the thread you were looking for.

    I hope this helps.

    Originally posted by Chris747
    Hi Folks,
    Two questions ....

    1) I'd like certain things to happen similiar to if(isLastBarOnChart()) but instead "if is this week" or " since this past sunday " (meaning this past week only). Any ideas ?

    2) Somewhere in this vast forum of information i believe I read about a thread explaining all the rules and tips and tricks about writing out a tab delimeted file ... spacings etc. I've not been able to find it .. if anyone has any thoughts as to where it might be, please let me know.

    Chris

    Comment


    • #3
      Hi Steve,
      I left for vacation before i got your response but wanted to say thanks !!! I'd had that link bookmarked, but it wasn't quite was i was looking for. Was hoping to find some tricks that wizards might have come up with to negate extra spaces caused by a negative signs or something like that. But i'm thinking now that theres just not too much to expect from tab delimted reporting. But thanks anyhow, as always your help is greatly appreciated !!
      Merry Christmas.

      Chris

      Comment


      • #4
        Hi Chris,

        Your welcome and Merry Christmas!

        Actually, there is a technique that may work for you. Add spaces to the right of your value, check for a negative sign, then use the string method substr().

        for example if you run this snippet:

        PHP Code:
        function stringPad(str,len){
         
        str+="                        "//~ start by adding spaces to the right
         
        if(str.charAt(0)!='-'){
          
        str=" "+str//~ then, if no negative sign, add a space to the left
         
        }
         return 
        str.substr(0,len); //~ now return the string to your selected length
        }

        var 
        a= -34.333333;
        var 
        b75.333333;
        var 
        c5000.23232323
        var d= -5000.23232323

        debugPrintln
        ("a = "+stringPad(a,8)+", b = " stringPad(b,8)+", c = " stringPad(c,10)+", d = " stringPad(d,10));

        //~ The output is...
        //~ a = -34.3333, b =  75.3333, c =  5000.2323, d = -5000.2323 
        The output is...

        a = -34.3333, b = 75.3333, c = 5000.2323, d = -5000.2323


        I hope this helps

        Comment


        • #5
          Thanks Steve !!!!!

          Thats just exactly the kind of trick I was looking for !! It hadn't even crossed my mind ...

          You Da Man !

          Chris

          Comment


          • #6
            Hi Chris,

            Your most welcome, good to hear.

            Comment

            Working...
            X