Jump to content

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

Recommended Posts

  • Newbies
Posted (edited)

I have a database hosted by FM Server that catalogs a list of my department's projects and publications (with supplemental materials, like PDFs, etc.). The database is web-published via WebDirect and is linked to from our main website so that users can filter, sort, and search our listings.

I would like to be able to pull into our database the number of times a publication has been cited from Google Scholar. Right now, I have a web viewer on the database record for each publication that shows the Google Scholar page for that pub where the information will come from and I have a calculation field that gets the content of the webviewer with this formula where "GoogleScholar1" is the name of the webviewer:

GoogleScholar_web = GetLayoutObjectAttribute ( "GoogleScholar1"; "content")

This field contains text that looks like this (this is just a section):

...... class="gsc_value">The Journal of Early Adolescence</div></div><div class="gs_scl"><div class="gsc_field">Volume</div><div class="gsc_value">32</div></div><div class="gs_scl"><div class="gsc_field">Issue</div><div class="gsc_value">5</div></div><div class="gs_scl"><div class="gsc_field">Pages</div><div class="gsc_value">621-649</div></div><div class="gs_scl"><div class="gsc_field">Publisher</div><div class="gsc_value">SAGE Publications</div></div><div class="gs_scl"><div class="gsc_field">Description</div><div class="gsc_value" id="gsc_descr">Abstract To highlight individual and neighborhood interactions in the risk of adolescent <br>substance use, this study examined the moderating role of neighborhood disadvantage on <br>the relationship between pubertal development and adolescent girls&#39; substance use. <br>Drawing on the contextual amplification hypothesis, it was hypothesized that the effect of <br>pubertal development on substance use would vary by level of neighborhood disadvantage <br>and race. The sample included 5,591 adolescent girls from the National Longitudinal <b> ...</b></div></div><div class="gs_scl"><div class="gsc_field">Total citations</div><div class="gsc_value"><div style="margin-bottom:1em"><a href="https://scholar.google.com/scholar?oi=bibs&amp;hl=en&amp;cites=15750230415528023900&amp;as_sdt=5">Cited by 8</a></div><div id="gsc_graph"><div id="gsc_graph_x"></div><div.......

I need to pull the number that follows the text "cited by". I have tried several different text functions, etc. and nothing has gotten me close to getting this to work. Any ideas would be appreciated. I don't normally have to pull content from a web viewer into a database so this is new to me. Thanks in advance!

 

 

Edited by Deanna Meador
Posted

Extracting text from HTML is difficult and frustrating - esp. because the format can change at any moment and break your formula.

Still, in the absence of a viable alternative, try the following formula =

Let ( [
text = GoogleScholar_web ;
prefix = ">Cited by " ;
suffix = "<" ;

start = Position ( text ; prefix ; 1 ; 1 ) + Length ( prefix ) ;
end = Position ( text ; suffix ; start ; 1 )
] ;
Middle ( text ; start ; end - start )
)

Note:

1. This assumes the prefix string ">Cited by " does not appear earlier in the HTML code (you're only showing us a portion of it);

2. I am not sure why you need the GoogleScholar_web calculation field; you could reference the web-viewer directly in the calculation by defining text as:

text = GetLayoutObjectAttribute ( "GoogleScholar1"; "content") ; 

3. Hopefully it's clear you would be using this in a Set Field[] script step, to populate a Number field.

  • Newbies
Posted

Thanks so much!  This worked like a charm :-)

I got rid of the extra field and incorporated the GetLayoutObjectAttribute piece into the Let function as you suggested.

Your help is greatly appreciated!

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