Community discussions

MikroTik App
 
mikmanager04
just joined
Topic Author
Posts: 3
Joined: Sun Aug 23, 2020 6:46 am

get comment array save to table

Tue Aug 23, 2022 9:51 pm

can anyone help im i want export the price and package to table without th

comment value format
,3,30 Minutes,5,1 Hour,10,2 Hours,20,3 Hours,30,5 Hours,40,1 Day,50,2 Days,60,3 Days,90,7 Days,150,15 Days,300,30 Days


:global RATE [/routing filter get [find chain=RATE] comment];

/file set flash/hotspot/rate.js contents= \
"document.getElementById('myTable').innerHTML='$RATE';"
:log info ("Rate Set");

iwant rate.js output like this

<tr><td>3</td><td>30 Minutes</td></tr>
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: get comment array save to table

Tue Aug 23, 2022 9:57 pm

You can add screenshot or picture with "Attachments" section when you add a post on a topic.

Do not use 3rd party sites (for monetiziong or not) for host images.
 
mikmanager04
just joined
Topic Author
Posts: 3
Joined: Sun Aug 23, 2020 6:46 am

Re: get comment array save to table

Tue Aug 23, 2022 10:23 pm

You can add screenshot or picture with "Attachments" section when you add a post on a topic.

Do not use 3rd party sites (for monetiziong or not) for host images.
found it , thank you

final output i want load the the file insert to table like this
You do not have the required permissions to view the files attached to this post.
 
mikmanager04
just joined
Topic Author
Posts: 3
Joined: Sun Aug 23, 2020 6:46 am

Re: get comment array save to table

Wed Aug 24, 2022 11:40 am

i change the get comment 90% finish now my last problem is combine the txt first tr & td and last closing td & tr tag like this
<tr><td>3</td><td>30 Minutes</td></tr>
:global contentz [/routing filter get [find chain=packageList] comment];
:global content [:pick $contentz 1 [:len $contentz]];
:set content ("$content" . "" . "|");
:global contentLen [ :len $content ] ;
:global lineEnd 0;
:global line "";
:global lastEnd 0;


:do {
       :set lineEnd [:find $content "|" $lastEnd ] ;
       :set line [:pick $content $lastEnd $lineEnd] ;
       :set lastEnd ( $lineEnd + 1) ;

       :local tmpArray [:toarray $line] ;
	:if ( [:pick $tmpArray 0] != "" ) do={
	:put $tmpArray;
         
/ppp secret add name=[:pick $tmpArray 3] comment=[:pick $tmpArray 0];
}
} while ($lineEnd < $contentLen)
You do not have the required permissions to view the files attached to this post.

Who is online

Users browsing this forum: Kanzler and 24 guests