Jump to content

Need Value List Number


This topic is 3874 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

 

I need the value list number, not the "Value" base on "A" number.

 

So, lets say I have a value list relationship of ID's ...

 

345

567

678

786

799

801

 

Value 799 is number "5" in the list.

 

I can get the value 799 if I manually enter "5", but I have a field where I've built a relationship that puts the ID of 799 into an ID fields base on the customer selection of drop down menus.

 

Based on this ID field ( 799 ) I would like to extract "5" from the ID value list relationship above.  And the following functions below don't seem to give me that option of extracting the "5" ( it would appear ).

 

 

ValueListItems ( Get ( FileName ) ; "Inventory ID" ) My value list of ID's
 
GetValue ( ValueListItems ( Get ( FileName ) ; "Inventory ID" ) ; "5" ) This get the "Value 799" not the list no "5".
 
ValueCount ( text ) ?? Not sure if I can use this or not.
 
Any assistance in this matter I would be grateful.
 
Thank you.
 
Tom
Link to comment
Share on other sites

Try =

ValueCount ( Left ( listOfValues ; Position ( ¶ & listOfValues & ¶ ; ¶ & searchValue & ¶ ; 1 ; 1 ) ) )

Since you are using ValueListItems to produce your listOfValues, each value will be unique and a recursive calculation is not necessary.
 

Link to comment
Share on other sites

Hi Consultant :-)

 

ValueCount ( Left ( List ( Navigation Search One to Inventory OneActiveOne::Inventory ID ) ; Position ( ¶ & List ( Navigation Search One to Inventory OneActiveOne::Inventory ID ) & ¶ ; ¶ & Navigation Search One to Preference One::Default Showroom PicID & ¶ ; 1 ; 1 ) ) )

 

The above calculation works GREAT!!  Gives me exactly what I wanted.  Thank you.

 

What throughs me are the "1's" and the "List" function in this calculation.  Can you explain them.  Am I to assume that the "No." I wanted is embedded within the "List" function ??  Being a robot is OK but can you break out the calculation and explain how the List No. is extracted.  I would be grateful :-)

 

When I use the "List" function in a "Message" box, all I get is the value(s) of the list not the List No. Sequence.  The above calculation did the trick, again thank you.

Link to comment
Share on other sites

Good lord, eos, that is one over-engineered custom function!

Here is an alternative, which is essentially the same as comment's. I like the way it's formatted:

http://www.briandunning.com/cf/1300

 

The 1's are the start and occurence parameters of the Position function.


Not sure what you want to know about List, but here's the link.

Link to comment
Share on other sites

can you break out the calculation and explain how the List No. is extracted.

 

1. What Fitch said.

2. Note that your implementation has to calculate the same

List ( Navigation Search One to Inventory OneActiveOne::Inventory ID )

twice; try the more efficient (and somewhat more readable) =

 

Let (
listOfValues = List ( Navigation Search One to Inventory OneActiveOne::Inventory ID ) ;
;
ValueCount ( Left ( listOfValues ; Position ( ¶ & listOfValues & ¶ ; ¶ & Navigation Search One to Preference One::Default Showroom PicID & ¶ ; 1 ; 1 ) ) )
)

or, if you prefer, break it out to =

 

Let ( [
listOfValues = List ( Navigation Search One to Inventory OneActiveOne::Inventory ID ) ;
searchValue = Navigation Search One to Preference One::Default Showroom PicID ;

pos = Position ( ¶ & listOfValues & ¶ ; ¶ & searchValue & ¶ ; 1 ; 1 ) ;
shortList = Left ( listOfValues ; pos )
] ;
ValueCount ( shortList )
)

 

 

Being a robot is OK

 

Flattery will get you everywhere...

  • Like 1
Link to comment
Share on other sites

Hi,

 

I'm still confused here ... sorry ? 

 

Position ( & listOfValues & ; & searchValue & ; 1 ; 1 )

ValueCount ( Left ( listOfValues ; Position ( & listOfValues & ; & searchValue & ; 1 ; 1 ) ) )

 

I read threw all the above possibilities and others before entering the forum, and when I stated that the "1's" through me, I meant that I could only getting the "Values" not the value "List No." when testing results ... so, when I saw the 1's in the position calculation, I still have the question.

 

Where is the List No.'s coming from ??? Is the "LIST No." embedded within the "Position" functions?? And I'm I to assume that it's in the first position??  In my testing and reading FM Functions I could not produce a visual list that showed me the "List No." sequence, only the values, hmm?

 

Any assistance here I would be grateful.  I apologize for this lack of understanding here.

 

Thank you.

 

Tom :-)

Link to comment
Share on other sites

I am not sure where exactly your difficulty lies. The calculation finds the position of searchValue in the list, then uses that to produce a short list. Using the example in your original post, the position of "799" in the given list (or more precisely, the position of "¶799¶" in the list surrounded by carriage returns) is 17. The first 17 characters of the list are:

 

345
567
678
786
7

 

and this short list contains 5 values.

Link to comment
Share on other sites

Hi,

 

Sorry for the incorrect naming.  I can not test the file until after 1 AM due to user being on the file.  So I apologize for these annoying question ...

 

My trouble lies in how the "Index" is determined / extracted.

 

So when you say "Position" and you've enter "1" and "1" I would still get "5" values if I enter "1" and "2" in the "Position" function ?? if "799" was the search value.

 

This would yield 18 characters in the short list of "5" values.  Yes / No ??

 

Thank you.

 

Tom :-)

Link to comment
Share on other sites

So when you say "Position" and you've enter "1" and "1" I would still get "5" values if I enter "1" and "2" in the "Position" function ?? if "799" was the search value.

 

This would yield 18 characters in the short list of "5" values.  Yes / No ?

 

 

No, you would get 0 from the Position() function, and consequently an empty string from the Left() function and 0 again as the result of ValueCount().. Since you have the Advanced version, you can open Data Viewer and test this yourself. Please read the help on the Position() function and the meaning of the start and occurrence parameters. Tom (Fitch) gave you the link in post #5 above.

Link to comment
Share on other sites

Hi,

 

Me again.

 

Well after reading and trying to understand ... I didn't want to click the "Post" button but I am just not getting it!  Please forgive me here. 

 

Position ( "Mississippi" ; "iss"; 1; 1 ) returns 2.  So, the first "1" is the starting point and the second "1" are the number of occurrences of "iss" you are looking for. Yes / No ? So how to you get two when you are asking for "1" occurrence of "iss".  Strange ??

 

Position ( "Mississippi" ; "iss"; 1; 2 ) returns 5.  Have no idea how "5" is ascertained ??

Position ( "Mississippi" ; "iss"; 3; 1 ) returns 5.  Again, no idea how "5" is ascertained ??

 

Tom :-(  Yikes!

Link to comment
Share on other sites

Hi Consultant,

 

A ha! I see it!  Makes perfect sense now.

 

Without having an image of a bicycle already in my mind, for me, the bicycle is often invisible.

 

Now that I have your picture, I have my reference.

 

Thank you for your patience with me.  I am grateful

 

Tom :-)

Link to comment
Share on other sites

Tom, that now make sense to me. 

 

FYI, the Forum provides a few different looks called Skins. These are just different browser view of the Forum. The Skin can be changed as shown in Doug's post, and with the different choices things can appear differently. Your skin appears to be the Default.

 

The forum allows you to modify the tag line, i.e. newbie to; consultant, lifetime learner, ChindoguMaker, etc. However, you can't do this until you have reached a minimum number of posts (I can't remember that number, but maybe someone else does).

Link to comment
Share on other sites

This topic is 3874 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.