Forum Discussion

MarkSchofer's avatar
MarkSchofer
Frequent Contributor
3 years ago
Solved

Detailed Question About Formatting

I have a python Script that reads from a spreadsheet

Long Story Short

It Reads Payee, PayDate and Payment Amount

def LookForCash():
# Checking the 'Cash Recipt Links' activity
# Log.Message("Drill Down","",pmNormal, attr)
browser = Aliases.browser
page = browser.Page("*")
PropArray = ["ObjectType","ObjectLabel"]
ValuesArray = ["Link","$4,077.94"]; -Hard Coded right now (and it works) I will be passing a variable within a loop
#browser = Aliases.browser
#page = browser.Page("*")
page.FindChild(PropArray, ValuesArray,10).click()
currentPage = browser.Page("*")
currentPage.Wait()
Log.Message(currentPage)

I formatted the spreadsheet and look like the Object Label and of course it only takes the unformatted value.   

IDEALLY IF I COULD extract the formatted value I would be pretty much done

Can I AQstring the ValuesArray here? Is there a better way?  

  • Can I AQstring the ValuesArray here? 

    Probably, since the value is a string.  Try it and see.

     

    Is there a better way? 

    I never got into using tables, although I know some here do.  I'd be reading straight from the spreadsheet or an equivalent .csv file.

     

     

5 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Can I AQstring the ValuesArray here? 

    Probably, since the value is a string.  Try it and see.

     

    Is there a better way? 

    I never got into using tables, although I know some here do.  I'd be reading straight from the spreadsheet or an equivalent .csv file.

     

     

    • MarkSchofer's avatar
      MarkSchofer
      Frequent Contributor
      wow worked first try PropArray = ["ObjectType","ObjectLabel"] ValuesArray = ["Link",aqConvert.CurrencyToFormatStr(4077.94,2,False,False,True)];
    • MarkSchofer's avatar
      MarkSchofer
      Frequent Contributor

      The spreadsheet part I have down fine.   I read the vales from the spreadsheet and then compare them the values on a web page. It is the conversion from the spreadsheet to the web page. The webpage (link) have commas and dollar signs and that is where the compare breaks down. But I had a brain storm while typing this (THANK YOU) and as you said I will heed your suggestion 

       

      Thank you for your thoughtful response

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        Happy to trigger brain storms any time.  ğŸŒ©