Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Get value from cell depending on another value on same row

0 Likes
930

Hi

I need some help to collect the value from column 1 based on the value in column 4

See example:

So I need to iterate each row to search for the value '000000000000010035'. I'm still trying to learn some Visual Basic looping, but can't get it to work, I have something like this:

Dim Row as Integer
Dim ConsumptionProfile As String
Dim ValidUntil as Date
Dim Value as String

ConsumptionProfile = "000000000000010035"
Row = 1


' I want this first two rows to be in a loop, so that the Row variable adds +1 for each iteration
session.findById("wnd[0]/usr/tblSAPLE_LP_ASSIGNMENTTC_LOAD_PROFILE/ctxtELPASSLP-LOADPROFILE[4,"&Row &"]").setFocus 'The Focus isn't needed, but I have it here for debugging
Value = session.findById("wnd[0]/usr/tblSAPLE_LP_ASSIGNMENTTC_LOAD_PROFILE/ctxtELPASSLP-LOADPROFILE[4,"&Row &"]").text


'I wan't to exit the script when I have found the correct Value and then check in another cell but on the same Row as above
IF Value = ConsumptionProfile Then
ValidUntil = session.findById("wnd[0]/usr/tblSAPLE_LP_ASSIGNMENTTC_LOAD_PROFILE/ctxtELPASSLP-BIS[1,"&Row &"]").text
ValidUntil = CDate(ValidUntil)<br>

Would apreciete help with these kind of problem where I need to loop through rows to get a specific value, as I need to do this several times

Maybe some sort of exception handling when rows become an empty value (or last row) is also needed

Hi

I need some help to collect the value from column 1 based on the value in column 4

See example:

So I need to iterate each row to search for the value '000000000000010035'. I'm still trying to learn some Visual Basic looping, but can't get it to work, I have something like this:

Dim Row as Integer
Dim ConsumptionProfile As String
Dim ValidUntil as Date
Dim Value as String

ConsumptionProfile = "000000000000010035"
Row = 1


' I want this first two rows to be in a loop, so that the Row variable adds +1 for each iteration
session.findById("wnd[0]/usr/tblSAPLE_LP_ASSIGNMENTTC_LOAD_PROFILE/ctxtELPASSLP-LOADPROFILE[4,"&Row &"]").setFocus 'The Focus isn't needed, but I have it here for debugging
Value = session.findById("wnd[0]/usr/tblSAPLE_LP_ASSIGNMENTTC_LOAD_PROFILE/ctxtELPASSLP-LOADPROFILE[4,"&Row &"]").text


'I wan't to exit the script when I have found the correct Value and then check in another cell but on the same Row as above
IF Value = ConsumptionProfile Then
ValidUntil = session.findById("wnd[0]/usr/tblSAPLE_LP_ASSIGNMENTTC_LOAD_PROFILE/ctxtELPASSLP-BIS[1,"&Row &"]").text
ValidUntil = CDate(ValidUntil)<br>

Would apreciete help with these kind of problem where I need to loop through rows to get a specific value, as I need to do this several times

Maybe some sort of exception handling when rows become an empty value (or last row) is also needed

1 REPLY 1
Read only

former_member751591
Participant
0 Likes
836

Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with Community Q&A , as it provides tips for preparing questions that draw responses from our members.

For example, you can:

- outline what steps you took to find answers (and why they weren't helpful)

- share screenshots of what you've seen/done

- make sure you've applied the appropriate tags

- use a more descriptive subject line.

The more details you provide, the more likely it is that members will be able to respond. Feel free to also take our Q&A tutorial Q&A tutorial

Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your Profile you encourage readers to respond.