Jump to content
Server Maintenance This Week. ×

finding repetition in Custom Functions


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

Recommended Posts

Hello everyone;

I am noticing many similar traits with custom functions and scripts.

Can someone please attach any / links to perhaps studied algorithms based on recursion,search,etc

Or is this something one learns with time.

@Comment has some amazing techniques that seem so "Technical" and not just out of the blue, makes me believe he has a degree in computer science ! : )

Let me go on...

Some functions usually save positions where you are located, for example , starting text, or 2nd value in a list,etc

Finds the end value and then grabs all the data in between to do some stuff with.


Let([

Vn = ValueCount(Tips::gLibrary);

P1 = Position(¶ & Tips::gLibrary; ¶ & ID & " "; 1; 1);

P2 = P1 + 1 + Length(ID);

P3 = Position(¶ & Tips::gLibrary & ¶; ¶; P2; 1);

T1 = Middle(Tips::gLibrary; P2; P3 - P2 - 1);

T2 = If(p1 > 0; Substitute(T1; ["°"; "\\\""]; ["‡"; "\¶"]; ["·"; " "]))];

Evaluate(T2)

)

In this code, is one example.

THe cF is GetTips(ID)

* i understand what the 1st 2 runs are doing, then i am lost completely. Plain english. There are no comments so hard for me to get why Ray Cologon is doing what he is doing here.

  • P2 = P1 + 1 + Length(ID);
    P3 = Position(¶ & Tips::gLibrary & ¶; ¶; P2; 1);
    T1 = Middle(Tips::gLibrary; P2; P3 - P2 - 1);
    T2 = If(p1 > 0; Substitute(T1; ["°"; "\\\""]; ["‡"; "\¶"]; ["·"; " "]))];
    Evaluate(T2)

thanks

-ian

Link to comment
Share on other sites

So , i have learned that this is a convoluted way they used to grab the middle data, now we use GetValue ( DATA; Nbr )

If you want to see what this does, copy the code in data viewer'


Let([

//Instead of ID - put in your own # such as 1, 2 , 10,etc

Vn = ValueCount(BaseTable:FirstName);

P1 = Position(¶ & BaseTable:FirstName; ¶ & 1 & " "; 1; 1);

P2 = P1 + 1 + Length(ID); //use Length( 4)

P3 = Position(¶ & BaseTable::FirstName & ¶; ¶; P2; 1);

T1 = Middle(BaseTable::FirstName; P2; P3 - P2 - 1);

T2 = If(p1 > 0; Substitute(T1; ["°"; """]; ["‡"; "¶"]; ["·"; " "]))

];

//Here you can place the Vars; P1 & P2 & P3 & T1 to see what the value is in the dataviewer

T1

)

Hope this helps someone out there

*Thanks Fitch for the help on this one...

Link to comment
Share on other sites

This topic is 4419 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.