Formula to calculate days off - InfoPath Dev
in

InfoPath Dev

Formula to calculate days off

Last post 07-27-2009 08:40 AM by acarita. 36 replies.
Page 3 of 3 (37 items) < Previous 1 2 3
Sort Posts: Previous Next
  • 07-24-2009 11:08 AM In reply to

    Re: Formula to calculate days off

    I apologize if I dont completely understand.  @Remainingpays is set as the output in the stored procedure. 

    set @Remainingpays = (select sum(1)                          --as Remainingpays

    Are you lookiing for a line of code out of the form code, or from the stored procedure?

  • 07-24-2009 11:16 AM In reply to

    Re: Formula to calculate days off

     The part that looks something like this:

    dc.Command = 'DECLARE @remainingPays smallint '
    + 'EXECUTE "dbo"."VCS_SP_Remaining_Pays" \'' + HireDateV + '\', @remainingPays OUTPUT '
    + 'SELECT @remainingPays as RemainingPays';

    Did you copy it exactly, or did you modify it somehow?

    And why is "Pays" capitalized in your post from 30 minutes ago

    var rp = ds.selectSingleNode('dfs:myFields/dfs:dataFields/d:row/@RemainingPays').text; 

    while it's lowercase in your post from 10 minutes ago?

    var rp = ds.selectSingleNode('dfs:myFields/dfs:dataFields/d:row/@Remainingpays').text;

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-24-2009 11:24 AM In reply to

    Re: Formula to calculate days off

    dc.Command = 'DECLARE @remainingPays smallint ' + 'EXECUTE "dbo"."VCS_SP_Remaining_Pays" \'' + HireDateV + '\', @Remainingpays OUTPUT ' + 'SELECT @Remainingpays as RemainingPays';

    The only thing I changed from the code was making pays lowercase in @Remainingpays.  In the storedprocedure the "p" is lowercase.  The post from 30 min ago I just copy and pasted those 2 lines from your reply and forgot to change the "p".

  • 07-24-2009 11:32 AM In reply to

    Re: Formula to calculate days off

     If the P is capitalized here:

     dc.Command = 'DECLARE @remainingPays smallint ' + 'EXECUTE "dbo"."VCS_SP_Remaining_Pays" \'' + HireDateV + '\', @Remainingpays OUTPUT ' + 'SELECT @Remainingpays as RemainingPays';

    Then it should be capitalized here:

     var rp = ds.selectSingleNode('dfs:myFields/dfs:dataFields/d:row/@Remainingpays').text;

    There was really no need to change any of the capitalization from what I provided you in the first place.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-24-2009 11:48 AM In reply to

    Re: Formula to calculate days off

    My apologies.  I put it back and the command went through without error. 

    I'm still not clear on how I can see the value that should be returned.  I'm trying to understand, so forgive me if my question seems silly.

    I dont understand the var = rp... line that we entered.  This

    'dfs:myFields/dfs:dataFields/d:row/@RemainingPays'

    looks to me like it is referencing a field in the forms datasource.  When I go to the SQL datasource, I don't have "row" below dataFields, I just have the name of the table.  Do I need to setup a datasource using that path? 

  • 07-24-2009 07:58 PM In reply to

    Re: Formula to calculate days off

     Once you have the value stored in the rp variable you are free to manipulate it, perform calculations with it, or store it in a field in your main data source so it can be manipulated within the form:

     XDocument.DOM.selectSingleNode('my:myFields/my:RemainingPays').text = rp;

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-27-2009 08:40 AM In reply to

    Re: Formula to calculate days off

    That worked!  Thank you for taking the time to help me out.  I was able to create my formula using the value returned from the stored procedure and I have the correct final value that I am expecting. 

    I appreciate your help.

Page 3 of 3 (37 items) < Previous 1 2 3
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.