Options

Converting Service Period to Days

Trevor_NorcrossTrevor_Norcross Member Posts: 29
Rookie dev question here.. Trying to come up with the code that converts a service period (ie 30D, 1Q. 1Y) into days. For example if the user enters 1Q, I want the onValidate trigger to convert that to 90D. Not sure what the command or syntax is I am looking for. Thank you!
Trevor Norcross
SharePoint Implementation and Development
Network Administration
Mirifex Systems

Comments

  • Options
    randrewsrandrews Member Posts: 135
    In the TextBox put this code on trigger
    OnAfterInput(VAR Text : Text[1024];)
    date1:=WORKDATE;//any date
    date2 := CALCDATE(Text,date1);
    Text := FORMAT(date2-date1)+'D';
    

    It works. I tried
  • Options
    Trevor_NorcrossTrevor_Norcross Member Posts: 29
    OK that does work, thank you... now what if I wanted to put that text variable back into the table as a dateformula... how can I convert from a text variable to a dateformula?
    Trevor Norcross
    SharePoint Implementation and Development
    Network Administration
    Mirifex Systems
  • Options
    randrewsrandrews Member Posts: 135
    ???
    Text is variable VarRef:
    OnAfterInput(VAR Text : Text[1024];)
    
    So you put that text variable back in table
    Text := FORMAT(date2-date1)+'D';
    

    But how to convert text into dateformula at triger OnValidate, for example, I don't know.

    May be somebody else have idea?
  • Options
    Trevor_NorcrossTrevor_Norcross Member Posts: 29
    I think you understand what I'm trying to do now... using your code, I now have a text variable with some value such as '10D' and I want to change a DateFormula field in a table to have this text variable's value.
    Trevor Norcross
    SharePoint Implementation and Development
    Network Administration
    Mirifex Systems
  • Options
    jreynoldsjreynolds Member Posts: 175
    EVALUATE(DateFormula,Text)
Sign In or Register to comment.