Hello all
I wrote an expression without errors, but the result is incorrect.
Is the expression written incorrectly, or is there another solution?
Please help
Expression:
var path = "\\192.168.10.20\\ls\\Number\\Year";
var year = $feature.Year; // Assuming Year is a field in your dataset
var number = $feature.Number; // Assuming Number is a field in your dataset
return path + "\\" + year + "\\" + number;
I wrote "\\" but the result shows \, so the result is not required and the path cannot be accessed.
Please help
Solved! Go to Solution.
If you need two backslashes I would try in any string "\\\\" in any string you need it.
one backslash is like a command "\n" breaks a new line "\t" is a tab, and so on.
"\\" means draw a single backslash.....if you want 2, a guess you need 4, right?
Could you try it?
@HusamJubeh, The syntax and workflow seems correct.
Could you try opening it with "Ctrl + 'Click'"? [i.e. press "Ctrl" button on keyboard & simultaneously click the mouse button].
Is '14' here a folder or any file? Could you try with any file such as PDF, PNG, JPG etc.?
If it doesn't open, could you test the same with any local drive?
Thanks
I clicked "Ctrl + 'Click'", but the link could not be opened.
The path is inside the organization's server. If you copy and paste it, the process is completed successfully, but the expression cannot open the link.
If you need two backslashes I would try in any string "\\\\" in any string you need it.
one backslash is like a command "\n" breaks a new line "\t" is a tab, and so on.
"\\" means draw a single backslash.....if you want 2, a guess you need 4, right?
Could you try it?
Thanks
I added "\\\\" instead of "\\", and the process succeeded.
my regards
Three things:
1. Order of Parts
Line 1: Number\Year
Line 5: Year\Number
Which is the correct intention?
2. Intent of Script
Including my suggestion below, the three existing responses imply we have three slightly different understandings of the intent of your script. So maybe we should start there: What should the script return?
3. Path Concatenation
(N.B. This assumes that having the strings "Number" and "Year" as path elements is the error. If this is an incorrect assumption, see #2 above and let us know what you're looking for.)
Line 5 concatenates the entire path from Line 1. You'll need to strip it down, first. If that path is being generated automatically somewhere, you'd need to split & re-concatenate.
If the script you pasted is 100% of the script, then just remove "Number" and "Year" from Line 1.
Thanks
I typed "\\\\" instead of "\\" and it worked.
thank you for your comment