Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
Chandu507 Contributor.
Contributor.
454 views

TruClient - Files count in specific folder

Team,

I  need to get the count of total number of files present in specific location.

Can you please let me know if is there any default funcation that can be used in a Java script of Truclient protocol ?

Thanks.

0 Likes
7 Replies
Highlighted
JorgeDuran-PCLR Respected Contributor.
Respected Contributor.

Re: TruClient - Files count in specific folder

Hello,

Thanks for writting, 

In order to know that, you can create a C function to calculate that value and then you can call that function from truclient. 

Here you have some links for LR 12.60:

https://admhelp.microfocus.com/lr/en/12.60/help/function_reference/FuncRef.htm#FuncRef/c_language/etc/lrFuncRef_C_Lng_Funcs_cat.htm?Highlight=c%20function

Regards,

 

 

 

0 Likes
POORNIMA Contributor.
Contributor.

Re: TruClient - Files count in specific folder

Hi,

We have written a sample C code in truclient C-Functions.c file. But we are unable to call That c function in truclient, If we try to call that function we are getting the below error. 

Error message which we are getting:

t=00006754ms: ** 1: Evaluate C function 'Hello' ** started [MsgId: MMSG-205180]
t=00006994ms: Error -205177: C-Interpreter error 6: Error -- Unresolved symbol : 'Hello' [MsgId: MERR-205177]
t=00006994ms: Error -205177: Failed to evaluate the "'Hello'" C function (UNDEFINED). Internal: ciEvalFunRc=6, aVmContext=069504C0 fCiEvalFun [MsgId: MERR-205177]
t=00007182ms: Error -205177: ** 1: Evaluate C function 'Hello' ** failed - -2147467259 Snapshot Info [MSH 1 0] [MsgId: MERR-205177]

C function which we have written:

void main()
{
}
void Hello()
{
    lr_save_string("Hello World","Hello");
}

The function which we added in truclient :

Evaluate C

 

Thanks,

0 Likes
Outstanding Contributor.. JHF Remmelzwaal Outstanding Contributor..
Outstanding Contributor..

Re: TruClient - Files count in specific folder

You might try to use C-function names in only lower case.

In which file did you store your C functions? LR assumes a standard name.

Checkout Passing values to C-functions in TruClient, see also LR.evalC remarks

0 Likes
Outstanding Contributor.. JHF Remmelzwaal Outstanding Contributor..
Outstanding Contributor..

Re: TruClient - Files count in specific folder

I think I see what is wrong. Have a close look to your messages:

t=00006754ms: ** 1: Evaluate C function 'Hello' **

Error -205177: C-Interpreter error 6: Error -- Unresolved symbol : 'Hello'

Error -205177: Failed to evaluate the "'Hello'" C function (UNDEFINED).

When I tested it, get the message:

Evaluate C function setparamname ** successfully

Do you spot the single quotes around the function name? When you add a function name via the TueClient 'Evaluate C function' AND open the editor, at the bottom a message is displayed: "Use plain value. Do not put the value in quotation marks"

It is always a good idea to enter values in the TruClient UI via the editors, because at the bottom usefull info is displayed, like above or about JS name spaces. When experience comes you might ignore this advice.

0 Likes
POORNIMA Contributor.
Contributor.

Re: TruClient - Files count in specific folder

How to get/capture a return-value by the c-functions in truclient?

Thanks,

0 Likes
Outstanding Contributor.. JHF Remmelzwaal Outstanding Contributor..
Outstanding Contributor..

Re: TruClient - Files count in specific folder

Return value: use LR parameters.

0 Likes
Outstanding Contributor.. JHF Remmelzwaal Outstanding Contributor..
Outstanding Contributor..

Re: TruClient - Files count in specific folder

See this post for an example of counting the files in a directory.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.